Skip to content

Commit

Permalink
handle compiling errors in PyStand.int
Browse files Browse the repository at this point in the history
  • Loading branch information
skywind3000 committed Feb 27, 2023
1 parent 6171cd6 commit 84b59ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion PyStand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,19 @@ const char *init_script =
" site.addsitedir(test)\n"
"sys.argv = [PYSTAND_SCRIPT] + sys.argv[1:]\n"
"text = open(PYSTAND_SCRIPT, 'rb').read()\n"
"code = compile(text, PYSTAND_SCRIPT, 'exec')\n"
"environ = {'__file__': PYSTAND_SCRIPT, '__name__': '__main__'}\n"
"environ['__package__'] = None\n"
#ifndef PYSTAND_CONSOLE
"try:\n"
" code = compile(text, PYSTAND_SCRIPT, 'exec')\n"
" exec(code, environ)\n"
"except:\n"
" import traceback, io\n"
" sio = io.StringIO()\n"
" traceback.print_exc(file = sio)\n"
" os.MessageBox(sio.getvalue(), 'Error')\n"
#else
"code = compile(text, PYSTAND_SCRIPT, 'exec')\n"
"exec(code, environ)\n"
#endif
"";
Expand Down

0 comments on commit 84b59ff

Please sign in to comment.