src/eric7/Globals/__init__.py

branch
eric7
changeset 9420
92810aebc909
parent 9413
80c06d472826
child 9442
906485dcd210
child 9448
ea215f7afab3
--- a/src/eric7/Globals/__init__.py	Tue Oct 18 17:02:51 2022 +0200
+++ b/src/eric7/Globals/__init__.py	Tue Oct 18 17:48:03 2022 +0200
@@ -15,6 +15,7 @@
 import os
 import re
 import sys
+import sysconfig
 
 from PyQt6.QtCore import (
     QByteArray,
@@ -274,9 +275,17 @@
     @return path to the Python library directory
     @rtype str
     """
-    import sysconfig
+    return sysconfig.get_path("platlib")
+
 
-    return sysconfig.get_path("platlib")
+def getPythonScriptsDirectory():
+    """
+    Function to determine the path to Python's scripts directory.
+
+    @return path to the Python scripts directory
+    @rtype str
+    """
+    return sysconfig.get_path("scripts")
 
 
 def getPyQt6ModulesDirectory():
@@ -402,15 +411,10 @@
         program = "designer"
         if isWindowsPlatform():
             program += ".exe"
-            dirName = os.path.dirname(sys.executable)
-            if os.path.exists(os.path.join(dirName, program)):
-                binPath = dirName
-            elif os.path.exists(os.path.join(dirName, "Scripts", program)):
-                binPath = os.path.join(dirName, "Scripts")
-        else:
-            dirName = os.path.dirname(sys.executable)
-            if os.path.exists(os.path.join(dirName, program)):
-                binPath = dirName
+
+        progPath = os.path.join(getPythonScriptsDirectory(), program)
+        if os.path.exists(progPath):
+            binPath = getPythonScriptsDirectory()
 
     return QDir.toNativeSeparators(binPath)
 

eric ide

mercurial