Only add the path of the main script to sys.path, if it is not already in. eric7

Wed, 12 Oct 2022 17:37:54 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 12 Oct 2022 17:37:54 +0200
branch
eric7
changeset 9399
fcf9b48d8a0e
parent 9398
b5426d4f2187
child 9400
5494faeaead2

Only add the path of the main script to sys.path, if it is not already in.

src/eric7/eric7_ide.py file | annotate | diff | comparison | revisions
--- a/src/eric7/eric7_ide.py	Wed Oct 12 17:37:24 2022 +0200
+++ b/src/eric7/eric7_ide.py	Wed Oct 12 17:37:54 2022 +0200
@@ -34,7 +34,8 @@
 ]
 restartArgs = [arg for arg in sys.argv[1:] if arg.split("=", 1)[0] in restartArgsList]
 
-sys.path.insert(1, os.path.dirname(__file__))
+if os.path.dirname(__file__) not in sys.path:
+    sys.path.insert(1, os.path.dirname(__file__))
 
 try:
     from PyQt6.QtCore import qWarning, QLibraryInfo, QTimer, QCoreApplication

eric ide

mercurial