DebugClients/Python/coverage/execfile.py

changeset 6649
f1b3a73831c9
parent 6219
d6c795b5ce33
--- a/DebugClients/Python/coverage/execfile.py	Thu Jan 10 18:01:19 2019 +0100
+++ b/DebugClients/Python/coverage/execfile.py	Sat Jan 12 11:26:32 2019 +0100
@@ -111,7 +111,15 @@
 
     pathname = os.path.abspath(pathname)
     args[0] = pathname
-    run_python_file(pathname, args, package=packagename, modulename=modulename, path0="")
+    # Python 3.7.0b3 changed the behavior of the sys.path[0] entry for -m. It
+    # used to be an empty string (meaning the current directory). It changed
+    # to be the actual path to the current directory, so that os.chdir wouldn't
+    # affect the outcome.
+    if sys.version_info >= (3, 7, 0, 'beta', 3):
+        path0 = os.getcwd()
+    else:
+        path0 = ""
+    run_python_file(pathname, args, package=packagename, modulename=modulename, path0=path0)
 
 
 def run_python_file(filename, args, package=None, modulename=None, path0=None):

eric ide

mercurial