Help Center/
ModelArts/
Troubleshooting/
Training Jobs/
In-Cloud Migration Adaptation Issues/
Error Occurred When Pandas Reads Data from an OBS File If MoXing Is Used to Adapt to an OBS Path
Updated on 2025-06-06 GMT+08:00
Error Occurred When Pandas Reads Data from an OBS File If MoXing Is Used to Adapt to an OBS Path
Symptom
If MoXing is used to adapt to an OBS path, an error occurs when pandas of a later version reads data from an OBS file.
1. 'can't decode byte xxx in position xxx' 2. 'OSError:File isn't open for writing'
Possible Causes
The possible causes are as follows:
MoXing does not support Pandas of a later version.
Solution
- After the OBS path is adapted, change the file access mode from r to rb and change the _write_check_passed value in mox.file.File to True, as shown in the following sample code:
import pandas as pd import moxing as mox mox.file.shift('os', 'mox') # Replace the open operation of the operating system with the operation for adapting the mox.file.File to the OBS path. param = {'encoding': 'utf-8'} path = 'xxx.csv' with open(path, 'rb') as f: f._wirte_check_passed = True df = pd.read_csv(ff, **param)
- Use the local PyCharm to remotely access notebook for debugging.
Summary and Suggestions
Before creating a training job, use the ModelArts development environment to debug your training code and minimize migration errors.
- Use the notebook environment for online debugging. For details, see Using JupyterLab to Develop Models.
- Use a local IDE (PyCharm or VS Code) to access the cloud environment for debugging. For details, see Using a Local IDE to Develop Models.
Parent topic: In-Cloud Migration Adaptation Issues
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot