Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import utils.misc as misc: error solution #179

Open
shizuguilai opened this issue Jan 15, 2023 · 1 comment
Open

import utils.misc as misc: error solution #179

shizuguilai opened this issue Jan 15, 2023 · 1 comment

Comments

@shizuguilai
Copy link

My system is linux, and when I use main.py, it calls config.py. When “import utils.misc as misc“ and so on, it will report an error. However, if you add an empty init.py under src/utils, there will be no error.

@mingukkang
Copy link
Collaborator

If someone has a similar issue related to import modules, the following command will be helpful.

import pathlib
import sys
import os

# the path of the directory containing this file
root_path = pathlib.Path(__file__).parent.resolve()
root_path = os.path.join(str(root_path), "../")
sys.path.append(root_path)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants