Changeset View
Changeset View
Standalone View
Standalone View
plugins/python/scripter/ui_scripter/actions/runaction/runaction.py
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 83 | if document and self.editor._documentModified is False: | |||
---|---|---|---|---|---|
90 | # if there is a main() then execute it, otherwise don't worry... | 90 | # if there is a main() then execute it, otherwise don't worry... | ||
91 | if hasattr(users_module, "main") and inspect.isfunction(users_module.main): | 91 | if hasattr(users_module, "main") and inspect.isfunction(users_module.main): | ||
92 | users_module.main() | 92 | users_module.main() | ||
93 | else: | 93 | else: | ||
94 | code = compile(script, '<string>', 'exec') | 94 | code = compile(script, '<string>', 'exec') | ||
95 | globals_dict = {"__name__": EXEC_NAMESPACE} | 95 | globals_dict = {"__name__": EXEC_NAMESPACE} | ||
96 | exec(code, globals_dict) | 96 | exec(code, globals_dict) | ||
97 | 97 | | |||
98 | except SystemExit: | ||||
99 | # user typed quit() or exit() | ||||
100 | self.scripter.uicontroller.closeScripter() | ||||
98 | except Exception: | 101 | except Exception: | ||
99 | # Provide context (line number and text) for an error that is caught. | 102 | # Provide context (line number and text) for an error that is caught. | ||
100 | # Ordinarily, syntax and Indent errors are caught during initial | 103 | # Ordinarily, syntax and Indent errors are caught during initial | ||
101 | # compilation in exec(), and the traceback traces back to this file. | 104 | # compilation in exec(), and the traceback traces back to this file. | ||
102 | # So these need to be treated separately. | 105 | # So these need to be treated separately. | ||
103 | # Other errors trace back to the file/script being run. | 106 | # Other errors trace back to the file/script being run. | ||
104 | type_, value_, traceback_ = sys.exc_info() | 107 | type_, value_, traceback_ = sys.exc_info() | ||
105 | if type_ == SyntaxError: | 108 | if type_ == SyntaxError: | ||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |