BrownBiomechanics / SlicerAutoscoperM

This 3D Slicer extension enables users to perform image registration.
https://autoscoperm.slicer.org
MIT License
0 stars 4 forks source link

shutil.which fails to find autoscoper.exe when built from source #28

Closed NicerNewerCar closed 1 year ago

NicerNewerCar commented 1 year ago

The command shutil.which(autoscoper) fails to find the autoscoper.exe that is generated when the extension is built from source.

Previously, whenever I built SA^M from source shutil.which(autoscoper) would return the autoscoper.exe from the slicer cache directory (the version of SA^M downloaded from the extension manager).

This issue was initially found by @amymmorton see PR #27.

https://github.com/BrownBiomechanics/SlicerAutoscoperM/blob/444e2b87168d2da48ac5c4be0bf56c560683b6a6/AutoscoperM/AutoscoperM.py#L247-L251

NicerNewerCar commented 1 year ago

Appears to be an issue with the PATH variable used by os.environ

Appending the location of the autoscoper.exe to the path from os.environ and passing that to shutil.which works fine to find the correct executable.

current_path = os.environ["path"]
my_path = current_path + ";/path/to/autoscoper/executable/"

location = shutil.which("autoscoper", path=my_path)
NicerNewerCar commented 1 year ago

Note: SAM fails to launch Autoscoper because we are not installing it as a part of the Superbuild process