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

Avoid relative imports in Python scripts #1382

Open
kuguma opened this issue Feb 2, 2024 · 1 comment
Open

Avoid relative imports in Python scripts #1382

kuguma opened this issue Feb 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@kuguma
Copy link
Contributor

kuguma commented Feb 2, 2024

Many places in the current codebase have relative imports to common utility modules.

# import original modules
sys.path.append('../../util')

It is best to avoid this, as the results will depend on the directory at run time.

https://chat.openai.com/share/6e8b7c33-f160-40ef-8446-b9ef2de82c8d

@kuguma kuguma added the bug Something isn't working label Feb 2, 2024
@kuguma
Copy link
Contributor Author

kuguma commented Feb 2, 2024

MEMO:

It seems that arg_util is also assumed to be executed in the script directory, so
os.chdir(str(Path(__file__).resolve().parents[0]))
It might be easier to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant