Skip to content

Commit c6e45a1

Browse files
authored
Merge pull request #8 from myd7349/fix-encoding-issue
use binary reading to avoid encoding issues
2 parents 654066c + 6907d29 commit c6e45a1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

PyStand.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,11 @@ const char *init_script =
320320
" if os.path.exists(test): sys.path.append(test)\n"
321321
"sys.path.append(os.path.abspath(PYSTAND_HOME))\n"
322322
"sys.argv = [PYSTAND_SCRIPT] + sys.argv[1:]\n"
323-
"text = open(PYSTAND_SCRIPT).read()\n"
323+
"text = open(PYSTAND_SCRIPT, 'rb').read()\n"
324+
"code = compile(text, PYSTAND_SCRIPT, 'exec')\n"
324325
"environ = {'__file__': PYSTAND_SCRIPT, '__name__': '__main__'}\n"
325326
"environ['__package__'] = None\n"
326-
"exec(text, environ)\n"
327+
"exec(code, environ)\n"
327328
"";
328329

329330

0 commit comments

Comments
 (0)