summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2011-09-29 19:24:42 -0400
committerStan Seibert <stan@mtrr.org>2011-09-29 19:24:42 -0400
commit82f876e1f10974b8502caba7c33884543e646138 (patch)
tree118954cd31b5049f681d26cb04b81b13b61598c6 /bin
parent7b5b62603101f02062742662400857cc108ab561 (diff)
downloadchroma-82f876e1f10974b8502caba7c33884543e646138.tar.gz
chroma-82f876e1f10974b8502caba7c33884543e646138.tar.bz2
chroma-82f876e1f10974b8502caba7c33884543e646138.zip
Command line options to start the Python debugger on crash.
Not entirely effective for chroma-cam, since this does not catch exceptions thrown in child processes.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/chroma-cam6
-rwxr-xr-xbin/chroma-sim6
2 files changed, 12 insertions, 0 deletions
diff --git a/bin/chroma-cam b/bin/chroma-cam
index 6e52387..e81469e 100755
--- a/bin/chroma-cam
+++ b/bin/chroma-cam
@@ -8,8 +8,11 @@ if __name__ == '__main__':
from chroma import view, build, EventViewer
from chroma import mesh_from_stl
+ from chroma.tools import enable_debug_on_crash
parser = optparse.OptionParser('%prog')
+ parser.add_option('--debug', dest='debug', action='store_true',
+ default=False, help='Start python debugger on exception')
parser.add_option('-r', '--resolution', dest='resolution',
help='specify window resolution', default='1024,576')
parser.add_option('-i', dest='io_file', default=None)
@@ -18,6 +21,9 @@ if __name__ == '__main__':
if len(args) < 1:
sys.exit(parser.format_help())
+ if options.debug:
+ enable_debug_on_crash()
+
size = [int(s) for s in options.resolution.split(',')]
if os.path.exists(args[0]) and args[0].lower().endswith(('.stl', '.bz2')):
diff --git a/bin/chroma-sim b/bin/chroma-sim
index 9b4a536..8b0e44b 100755
--- a/bin/chroma-sim
+++ b/bin/chroma-sim
@@ -39,12 +39,18 @@ if __name__ == '__main__':
parser.add_option('--save-photons-end', action='store_true',
dest='save_photons_end',
help='save final photons to disk', default=False)
+ parser.add_option('--debug', dest='debug',
+ action='store_true', default=False,
+ help='Start python debugger on exception')
options, args = parser.parse_args()
if len(args) < 1:
sys.exit(parser.format_help())
+ if options.debug:
+ enable_debug_on_crash()
+
module_name, function_name = args[0].rsplit('.', 1)
try: