Update tellurium.py
Added RunTool
@@ -160,6 +160,27 @@ def readFromFile(filePath):
return string
+def runTool (toolFileName):
+ # """
+ # Call an external application called toolFileName
+ # NOte that .exe extension may be omitted for windows applications.
+
+ # Include any arguments in arguments parameter.
+
+ # Example:
+ # returnString = te.runTool (['myplugin', 'arg1', 'arg2'])
+ #
+ # If the external tool writes to stdout, this will be captured by this call.
+ # """
+ try:
+ if (os.name == 'nt') and (not toolFileName[0].endswith ('.exe')):
+ toolFileName[0] = toolFileName[0] + '.exe'
+
+ return subprocess.check_output(toolFileName)
+ except subprocess.CalledProcessError as e:
+ raise Exception ('Tool failed to run correctly or could not be found')
+
+
# ---------------------------------------------------------------------
# Loading Models Methods
# ---------------------------------------------------------------------
