From 84b59fff9b901ac8dd2068de88f36a8457204fec Mon Sep 17 00:00:00 2001 From: skywind3000 Date: Mon, 27 Feb 2023 19:50:32 +0800 Subject: [PATCH] handle compiling errors in PyStand.int --- PyStand.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PyStand.cpp b/PyStand.cpp index 12680a3..ce45b17 100644 --- a/PyStand.cpp +++ b/PyStand.cpp @@ -333,11 +333,11 @@ 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" @@ -345,6 +345,7 @@ const char *init_script = " 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 "";