Closed jcfr closed 11 years ago
For reference - See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=22144
JC, what do you mean by "fail graciously"? MultiVolumeImporter module is not an Editor or DICOM module plugin. So its failure to load does not affect functionality of any other module, as far as I understand. If import numpy fails, the module will just not show up on the module list. Looks gracious to me.
Can you suggest how a module can tell the main Slicer application that a dependency is not satisfied and it cannot be loaded?
Currently there are no mechanism allowing a module to "prevent" its loading by on the some logic. The idea wouldn't be to prevent the module from being loaded by to display a warning in the console if numpy is not available.
On Sat, Jul 6, 2013 at 1:12 PM, Andrey Fedorov notifications@github.comwrote:
Can you suggest how a module can tell the main Slicer application that a dependency is not satisfied and it cannot be loaded?
— Reply to this email directly or view it on GitHubhttps://github.com/fedorov/MultiVolumeImporter/issues/6#issuecomment-20557525 .
+1 919 869 8849
The module is not functional if numpy is not available.
If there is no numpy, the module should not be loaded. Right now it is not laded because the import exception is not caught.
Sure, I can print the warning message, but what is the alternative method to prevent the module from loading?
I am just trying to understand what should be the expected behavior of the module.
I talked to @pieper today, and he explained to me what you mean!! Sorry I didn't get it on my own. Will commit the fix now.
Something like what is done for simpleitk could be done. See https://github.com/Slicer/Slicer/commit/0d3f082