Mercurial > repos > peterjc > effectivet3
comparison tools/effectiveT3/effectiveT3.py @ 7:5f85301d50bf draft
v0.0.16, adding new model TTSS-STD-2.0.2.jar
author | peterjc |
---|---|
date | Mon, 21 Sep 2015 05:52:29 -0400 |
parents | 0f6eb4a75000 |
children | 60a9b3f760cc |
comparison
equal
deleted
inserted
replaced
6:0f6eb4a75000 | 7:5f85301d50bf |
---|---|
19 effectiveT3_dir = os.environ.get("EFFECTIVET3", "/opt/EffectiveT3/") | 19 effectiveT3_dir = os.environ.get("EFFECTIVET3", "/opt/EffectiveT3/") |
20 effectiveT3_jar = os.path.join(effectiveT3_dir, "TTSS_GUI-1.0.1.jar") | 20 effectiveT3_jar = os.path.join(effectiveT3_dir, "TTSS_GUI-1.0.1.jar") |
21 | 21 |
22 if "-v" in sys.argv or "--version" in sys.argv: | 22 if "-v" in sys.argv or "--version" in sys.argv: |
23 # TODO - Get version of the JAR file dynamically? | 23 # TODO - Get version of the JAR file dynamically? |
24 print("Wrapper v0.0.14, TTSS_GUI-1.0.1.jar") | 24 print("Wrapper v0.0.16, TTSS_GUI-1.0.1.jar") |
25 sys.exit(0) | 25 sys.exit(0) |
26 | 26 |
27 def sys_exit(msg, error_level=1): | 27 def sys_exit(msg, error_level=1): |
28 """Print error message to stdout and quit with given error level.""" | 28 """Print error message to stdout and quit with given error level.""" |
29 sys.stderr.write("%s\n" % msg) | 29 sys.stderr.write("%s\n" % msg) |
81 except Exception, err: | 81 except Exception, err: |
82 sys_exit("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) | 82 sys_exit("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) |
83 # Use .communicate as can get deadlocks with .wait(), | 83 # Use .communicate as can get deadlocks with .wait(), |
84 stdout, stderr = child.communicate() | 84 stdout, stderr = child.communicate() |
85 return_code = child.returncode | 85 return_code = child.returncode |
86 if return_code: | 86 if return_code or stderr.startswith("Exception in thread"): |
87 cmd_str= " ".join(cmd) # doesn't quote spaces etc | 87 cmd_str= " ".join(cmd) # doesn't quote spaces etc |
88 if stderr and stdout: | 88 if stderr and stdout: |
89 sys_exit("Return code %i from command:\n%s\n\n%s\n\n%s" % (return_code, cmd_str, stdout, stderr)) | 89 sys_exit("Return code %i from command:\n%s\n\n%s\n\n%s" % (return_code, cmd_str, stdout, stderr)) |
90 else: | 90 else: |
91 sys_exit("Return code %i from command:\n%s\n%s" % (return_code, cmd_str, stderr)) | 91 sys_exit("Return code %i from command:\n%s\n%s" % (return_code, cmd_str, stderr)) |
92 | |
92 | 93 |
93 if not os.path.isdir(effectiveT3_dir): | 94 if not os.path.isdir(effectiveT3_dir): |
94 sys_exit("Effective T3 folder not found: %r" % effectiveT3_dir) | 95 sys_exit("Effective T3 folder not found: %r" % effectiveT3_dir) |
95 | 96 |
96 if not os.path.isfile(effectiveT3_jar): | 97 if not os.path.isfile(effectiveT3_jar): |