axinc-ai / ailia-models

The collection of pre-trained, state-of-the-art AI models for ailia SDK
2.04k stars 325 forks source link

Avoid relative imports in Python scripts #1382

Open kuguma opened 9 months ago

kuguma commented 9 months ago

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 commented 9 months ago

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.