Scripted module dependency loaded too late for one module but for another one not

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Scripted module dependency loaded too late for one module but for another one not

criskross
Hi developers,

I noticed that there is something wrong with the order of when which dependency is loaded. It’s either a problem with my extensions or Slicer. Not sure about this. 

We have a module Quantitative Reporting [1] which depends (not much longer) on SlicerProstate [2]. I have been working on factoring out some code into another repository and I noticed that the dependency is loaded to late into Slicer (even when I compile the python scripted module).

Here an example for reproduction:

1. Execute the following in a directory that you want to use for testing this issue:


2. Add the top-level directory of QuantitativeReporting to your current Slicer
3. Compile SlicerProstate 
4. Add the {SlicerProstate_Build_Directory}/lib/Slicer4.7/qt-scripted-modules 
5. Restart Slicer
—> Everything should be fine. No errors visible in python console

Now try this:
1. Delete {SlicerProstate_Build_Directory}/lib/Slicer4.7/qt-scripted-modules or delete DistanceMapBasedRegistration.py and skip steps 2-5.
  2. Open CMakeLists.txt in toplevel directory of SlicerProstate for editing
  3. Delete the following lines 21-24:
add_subdirectory(QuadEdgeSurfaceMesher) 
add_subdirectory(SegmentationSmoothing) 
add_subdirectory(DistanceMapBasedRegistration) 
add_subdirectory(DWModeling)
  4. Compile SlicerProstate 
  5. Add the {SlicerProstate_Build_Directory}/lib/Slicer4.7/qt-scripted-modules 
6. Restart Slicer
>>> Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/christian/sources/py/Reporting/QuantitativeReporting.py", line 8, in <module>
from SlicerProstateUtils.mixins import *
ImportError: No module named SlicerProstateUtils.mixins

When I add mpReview[3] (both depend on SlicerProstate) I only get errors from QuantitativeReporting but not form mpReview displayed.

I am not sure about the cause, but I assume that the cause why it’s is properly loaded in the first scenario is that DistanceMapBasedRegistration.py coexists next to SlicerProstate.py.


Hope someone can help me with that issue.

Thanks,
Christian




_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ

smime.p7s (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Scripted module dependency loaded too late for one module but for another one not

lasso2

We moved to  moved to discourse.slicer.org. Could you please post the question there?

 

Thank you,

Andras

 

From: [hidden email]
Sent: Tuesday, April 18, 2017 5:21 PM
To: [hidden email]
Subject: [slicer-devel] Scripted module dependency loaded too late for one module but for another one not

 

Hi developers,

I noticed that there is something wrong with the order of when which dependency is loaded. It’s either a problem with my extensions or Slicer. Not sure about this. 

We have a module Quantitative Reporting [1] which depends (not much longer) on SlicerProstate [2]. I have been working on factoring out some code into another repository and I noticed that the dependency is loaded to late into Slicer (even when I compile the python scripted module).

Here an example for reproduction:

1. Execute the following in a directory that you want to use for testing this issue:


2. Add the top-level directory of QuantitativeReporting to your current Slicer
3. Compile SlicerProstate 
4. Add the {SlicerProstate_Build_Directory}/lib/Slicer4.7/qt-scripted-modules 
5. Restart Slicer
—> Everything should be fine. No errors visible in python console

Now try this:
1. Delete {SlicerProstate_Build_Directory}/lib/Slicer4.7/qt-scripted-modules or delete DistanceMapBasedRegistration.py and skip steps 2-5.
  2. Open CMakeLists.txt in toplevel directory of SlicerProstate for editing
  3. Delete the following lines 21-24:
add_subdirectory(QuadEdgeSurfaceMesher) 
add_subdirectory(SegmentationSmoothing) 
add_subdirectory(DistanceMapBasedRegistration) 
add_subdirectory(DWModeling)
  4. Compile SlicerProstate 
  5. Add the {SlicerProstate_Build_Directory}/lib/Slicer4.7/qt-scripted-modules 
6. Restart Slicer
>>> Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/christian/sources/py/Reporting/QuantitativeReporting.py", line 8, in <module>
from SlicerProstateUtils.mixins import *
ImportError: No module named SlicerProstateUtils.mixins

When I add mpReview[3] (both depend on SlicerProstate) I only get errors from QuantitativeReporting but not form mpReview displayed.

I am not sure about the cause, but I assume that the cause why it’s is properly loaded in the first scenario is that DistanceMapBasedRegistration.py coexists next to SlicerProstate.py.


Hope someone can help me with that issue.

Thanks,
Christian




_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Scripted module dependency loaded too late for one module but for another one not

Jean-Christophe Fillion-Robin
Hi Christian,

I copied your question on the forum, and will provide answer there.

For reference: https://discourse.slicer.org/t/scripted-module-dependency-loaded-too-late-for-one-module-but-for-another-one-not/142

On Tue, Apr 18, 2017 at 6:56 PM, Andras Lasso <[hidden email]> wrote:

We moved to  moved to discourse.slicer.org. Could you please post the question there?

 

Thank you,

Andras

 

From: [hidden email]
Sent: Tuesday, April 18, 2017 5:21 PM
To: [hidden email]
Subject: [slicer-devel] Scripted module dependency loaded too late for one module but for another one not

 

Hi developers,

I noticed that there is something wrong with the order of when which dependency is loaded. It’s either a problem with my extensions or Slicer. Not sure about this. 

We have a module Quantitative Reporting [1] which depends (not much longer) on SlicerProstate [2]. I have been working on factoring out some code into another repository and I noticed that the dependency is loaded to late into Slicer (even when I compile the python scripted module).

Here an example for reproduction:

1. Execute the following in a directory that you want to use for testing this issue:


2. Add the top-level directory of QuantitativeReporting to your current Slicer
3. Compile SlicerProstate 
4. Add the {SlicerProstate_Build_Directory}/lib/Slicer4.7/qt-scripted-modules 
5. Restart Slicer
—> Everything should be fine. No errors visible in python console

Now try this:
1. Delete {SlicerProstate_Build_Directory}/lib/Slicer4.7/qt-scripted-modules or delete DistanceMapBasedRegistration.py and skip steps 2-5.
  2. Open CMakeLists.txt in toplevel directory of SlicerProstate for editing
  3. Delete the following lines 21-24:
add_subdirectory(QuadEdgeSurfaceMesher) 
add_subdirectory(SegmentationSmoothing) 
add_subdirectory(DistanceMapBasedRegistration) 
add_subdirectory(DWModeling)
  4. Compile SlicerProstate 
  5. Add the {SlicerProstate_Build_Directory}/lib/Slicer4.7/qt-scripted-modules 
6. Restart Slicer
>>> Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/christian/sources/py/Reporting/QuantitativeReporting.py", line 8, in <module>
from SlicerProstateUtils.mixins import *
ImportError: No module named SlicerProstateUtils.mixins

When I add mpReview[3] (both depend on SlicerProstate) I only get errors from QuantitativeReporting but not form mpReview displayed.

I am not sure about the cause, but I assume that the cause why it’s is properly loaded in the first scenario is that DistanceMapBasedRegistration.py coexists next to SlicerProstate.py.


Hope someone can help me with that issue.

Thanks,
Christian




_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ



--
+1 919 869 8849

_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Loading...