blob: e46b608ed6c589d30ce123b20d0791ab39892e03 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
'execfile' is python-2-only. 'exec/open' works for both python2 and python3.
--- a/gui-wx/wxpython.cpp
+++ b/gui-wx/wxpython.cpp
@@ -3356,7 +3388,7 @@ void RunPythonScript(const wxString& filepath)
// for the global namespace so that this script cannot change the
// globals of a caller script (which is possible now that RunScript
// is re-entrant)
- wxString command = wxT("execfile('") + fpath + wxT("',{})");
+ wxString command = wxT("exec(open('") + fpath + wxT("').read(),{})");
PyRun_SimpleString(command.mb_str(wxConvLocal));
// don't use wxConvUTF8 in above line because caller has already converted
// filepath to decomposed UTF8 if on a Mac
|