1818from . import _moose
1919from ._moose import *
2020import __main__ as main
21- from .SBML .readSBML import mooseReadSBML
22- from .SBML .writeSBML import mooseWriteSBML
23- from .genesis .writeKkit import mooseWriteKkit
21+
22+ sbmlSupport_ , genesisSupport_ = True , True
23+ try :
24+ from .SBML .readSBML import mooseReadSBML
25+ from .SBML .writeSBML import mooseWriteSBML
26+ except Exception as e :
27+ print ( 'MOOSE could not load SBML support' )
28+ print ( '\t Error was %s' % e )
29+ sbmlSupport_ = False
30+
31+ try :
32+ from .genesis .writeKkit import mooseWriteKkit
33+ except Exception as e :
34+ print ( 'MOOSE could not load GENESIS support' )
35+ print ( '\Error was %s' % e )
36+ genesisSupport_ = False
37+
2438from add_Delete_ChemicalSolver import moosedeleteChemSolver ,mooseaddChemSolver
2539
2640sequence_types = ['vector<double>' ,
@@ -57,6 +71,10 @@ def mooseReadSBML( filepath, loadpath, solver = 'ee' ):
5771 solver -- Solver to use (default 'ee' ) \n
5872
5973 """
74+ global sbmlSupport_
75+ if not sbmlSupport_ :
76+ print ( 'SBML support was not loaded' )
77+ return None
6078 if not os .path .isfile ( filepath ):
6179 raise UserWarning ( 'File %s not found' % filepath )
6280
@@ -79,6 +97,12 @@ def mooseWriteSBML( modelpath, filenpath, sceneitems = { } ):
7997 --- else, auto-coordinates is used for layout position and passed
8098
8199 """
100+
101+ global sbmlSupport_
102+ if not sbmlSupport_ :
103+ print ( 'SBML support was not loaded' )
104+ return None
105+
82106 return mooseWriteSBML ( modelpath , filepath , sceneitems )
83107
84108def mooseWriteKkit (modelpath ,filepath ):
@@ -89,6 +113,11 @@ def mooseWriteKkit(modelpath,filepath):
89113 modelpath -- model path in moose \n
90114 filepath -- Path of output file.
91115 """
116+ global genesisSupport_
117+ if not genesisSupport_ :
118+ print ( 'GENESIS(kkit) support was not loaded' )
119+ return None
120+
92121 return mooseWiteKkit (modelpath ,filepath )
93122
94123def moosedeleteChemSolver (modelpath ):
0 commit comments