DCBIA-OrthoLab / SlicerAutomatedDentalTools

A 3D Slicer extension to use AMASSS, ALI-CBCT and ALI-IOS
Other
79 stars 22 forks source link

BUG : couldn't find ALI_IOS_WSL.py #93

Closed GaelleLeroux closed 2 months ago

GaelleLeroux commented 3 months ago

Hi @allemangD !

When I updated ALI_IOS to run on Windows, I used WSL. To be able to run the python file ALI_IOS_WSL.py in WSL, I need the full path to where the file is located. Before this pull request it was located in the ALI_IOS/utils folder of this repository, but when you install Slicer on Windows, the folder configuration is not the same. This resulted in an error because I had the wrong path. When I took a look in my folder after installing AutomatedDentalTools as a user, I can see the folder "ASO_Method" or "AREG_Method". I tried to do the same thing, creating a new folder "ALI_IOS_utils" in "ALI" to be able to create the path to ALI_IOS_WSL.py after the user installation.

image

What do you think ? It is ok to do it that way ? Do you have another way to locate this file ?

Thank you ! Gaelle

allemangD commented 2 months ago

Do you have another way to locate this file ?

There is probably a cleaner way to do this by carefully choosing the PYTHONPATH environment variable and/or working directory when launching the script in the conda environment...

Normally when I see variations on os.path.join(__file__, ...) I suggest importlib instead - however that won't help here since we do not want to import the file in the current Python interpreter, we want to direct the conda-managed interpreter to import the file. Passing an absolute path as you're doing is probably the most straightforward way, unless you were able to determine where/why the conda-managed interpreter PYTHONPATH seems incorrect.

I'll leave it to you whether you want to investigate PYTHONPATH or if you want to merge this as is.

GaelleLeroux commented 2 months ago

I will take a look at PYTHONPATH but I think we can merge this as is to will fix the bug for now