Skip to content

Commit 84b59ff

Browse files
author
skywind3000
committed
handle compiling errors in PyStand.int
1 parent 6171cd6 commit 84b59ff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

PyStand.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,19 @@ const char *init_script =
333333
" site.addsitedir(test)\n"
334334
"sys.argv = [PYSTAND_SCRIPT] + sys.argv[1:]\n"
335335
"text = open(PYSTAND_SCRIPT, 'rb').read()\n"
336-
"code = compile(text, PYSTAND_SCRIPT, 'exec')\n"
337336
"environ = {'__file__': PYSTAND_SCRIPT, '__name__': '__main__'}\n"
338337
"environ['__package__'] = None\n"
339338
#ifndef PYSTAND_CONSOLE
340339
"try:\n"
340+
" code = compile(text, PYSTAND_SCRIPT, 'exec')\n"
341341
" exec(code, environ)\n"
342342
"except:\n"
343343
" import traceback, io\n"
344344
" sio = io.StringIO()\n"
345345
" traceback.print_exc(file = sio)\n"
346346
" os.MessageBox(sio.getvalue(), 'Error')\n"
347347
#else
348+
"code = compile(text, PYSTAND_SCRIPT, 'exec')\n"
348349
"exec(code, environ)\n"
349350
#endif
350351
"";

0 commit comments

Comments
 (0)