acil-bwh / SlicerCIP

Slicer extension for the Chest Imaging Platform
BSD 3-Clause "New" or "Revised" License
15 stars 22 forks source link

Fix relative path import error (BodyComposition) #30

Closed pieper closed 3 years ago

pieper commented 3 years ago

Without this change the import error reported below occurs on mac installation.

With this change things work as expected.

I believe the no-dot version is correct and the dot is not needed in this scenario.

[CRITICAL][Stream] 06.08.2020 14:48:02 [] (unknown:0) - Traceback (most recent call last):
[CRITICAL][Stream] 06.08.2020 14:48:02 [] (unknown:0) -   File "<string>", line 1, in <module>
[CRITICAL][Stream] 06.08.2020 14:48:02 [] (unknown:0) -   File "/Applications/Slicer 3.app/Contents/lib/Python/lib/python3.6/imp.py", line 170, in load_source
[CRITICAL][Stream] 06.08.2020 14:48:02 [] (unknown:0) -     module = _exec(spec, sys.modules[name])
[CRITICAL][Stream] 06.08.2020 14:48:02 [] (unknown:0) -   File "<frozen importlib._bootstrap>", line 618, in _exec
[CRITICAL][Stream] 06.08.2020 14:48:02 [] (unknown:0) -   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
[CRITICAL][Stream] 06.08.2020 14:48:02 [] (unknown:0) -   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[CRITICAL][Stream] 06.08.2020 14:48:02 [] (unknown:0) -   File "/Applications/Slicer 3.app/Contents/Extensions-29253/Chest_Imaging_Platform/lib/Slicer-4.11/qt-scripted-modules/CIP_BodyComposition.py", line 18, in <module>
[CRITICAL][Stream] 06.08.2020 14:48:02 [] (unknown:0) -     from .CIP_BodyComposition_logic import BodyCompositionParameters
[CRITICAL][Stream] 06.08.2020 14:48:02 [] (unknown:0) - ImportError: attempted relative import with no known parent package
[CRITICAL][Qt] 06.08.2020 14:48:02 [] (unknown:0) - loadSourceAsModule - Failed to load file "/Applications/Slicer 3.app/Contents/Extensions-29253/Chest_Imaging_Platform/lib/Slicer-4.11/qt-scripted-modules/CIP_BodyComposition.py"  as module "CIP_BodyComposition" !
[CRITICAL][Qt] 06.08.2020 14:48:02 [] (unknown:0) - Fail to instantiate module  "CIP_BodyComposition"
[CRITICAL][Qt] 06.08.2020 14:48:03 [] (unknown:0) - The following modules failed to be instantiated:
[CRITICAL][Qt] 06.08.2020 14:48:03 [] (unknown:0) -    CIP_BodyComposition
pieper commented 3 years ago

@rjosest the CIP extension is now available but this error happens at startup.

lassoan commented 3 years ago

@rjosest We can spend some time with fixing CIP incompatibility issues with current Slicer version as they are being discovered, but it is important to get these fixes integrated. Let us know which option you prefer:

acil-bwh commented 3 years ago

@lassoan Thank you so much for your help to maintain SlicerCIP. We are looking to hire someone to take over this role. In the meantime, we are happy to review and integrate changes. Let me go over the current pull request.

lassoan commented 3 years ago

Sounds great, thank you!

acil-bwh commented 3 years ago

@lassoan @pieper Btw, we follow the approach of creating a branch for each release version of Slicer. Are you OK following this approach?

lassoan commented 3 years ago

Yes, having a separate branch for each Slicer major.minor version makes sense.