doc-exports/docs/modelarts/umn/modelarts_13_0003.html
Lai, Weijian 4e4b2d5f6d ModelArts UMN 23.3.0 Version.
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Lai, Weijian <laiweijian4@huawei.com>
Co-committed-by: Lai, Weijian <laiweijian4@huawei.com>
2024-06-26 07:03:02 +00:00

5.3 KiB

Notebook Instance Failed to Reference the .py File in the Same Directory

Symptom

After the user run the python a.py command in the Terminal environment of a notebook instance, the .py file in the same directory failed to be referenced, and the following error is reported:

ModuleNotFoundError: No module named 'b'.

Figure 3 shows the directory structure. Figure 2 provides details about the operation and the error.
Figure 1 Directory structure
Figure 2 Reference error

Possible Cause

After running the ls command in Terminal to check the file directory, it is found that a.py and b.py are not in the same directory.

Figure 3 Viewing the file directory

Solution

  1. Log in to the ModelArts management console, and choose DevEnviron > Notebooks.
  2. In the Operation column of the target notebook instance in the notebook list, click Open to go to the Jupyter page.
  3. On the Files tab page of the Jupyter page, select the a.py and b.py files, and click Sync OBS to synchronize the selected objects from the OBS bucket path to the current container directory ~/work. Then the objects can be invoked in code.
    Figure 4 Synchronizing files