eric6/DebugClients/Python/DebugUtilities.py

changeset 8228
772103b14c18
parent 8221
0572a215bd2f
child 8273
698ae46f40a4
diff -r 349308e84eeb -r 772103b14c18 eric6/DebugClients/Python/DebugUtilities.py
--- a/eric6/DebugClients/Python/DebugUtilities.py	Mon Apr 12 19:05:23 2021 +0200
+++ b/eric6/DebugClients/Python/DebugUtilities.py	Mon Apr 12 19:21:40 2021 +0200
@@ -194,12 +194,12 @@
                     line = line.strip()
                     if line:
                         for name in PYTHON_NAMES:   # __IGNORE_WARNING_Y110__
-                            if line.startswith(
-                                '#!/usr/bin/env {0}'.format(name)
+                            if (
+                                line.startswith(
+                                    '#!/usr/bin/env {0}'.format(name)) or
+                                (line.startswith('#!') and name in line)
                             ):
                                 return True
-                            elif line.startswith('#!') and name in line:
-                                return True
                         return False
         else:
             return False
@@ -308,11 +308,13 @@
         if pyname in program:
             break
     else:
-        if not isWindowsPlatform() and startsWithShebang(args[0]):
-            # insert our interpreter as first argument
-            args.insert(0, sys.executable)
-        elif isWindowsPlatform() and args[0].lower().endswith(".py"):
-            # it is a Python script; insert our interpreter as first argument
+        if (
+            (not isWindowsPlatform() and startsWithShebang(args[0])) or
+            (isWindowsPlatform() and args[0].lower().endswith(".py"))
+        ):
+            # 1. insert our interpreter as first argument if not Windows
+            # 2. insert our interpreter as first argument if on Windows and
+            #    it is a Python script
             args.insert(0, sys.executable)
     
     # extract list of interpreter arguments, i.e. all arguments before the

eric ide

mercurial