jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/586017 )
Change subject: [bugfix] insert absolute path to sys.path ......................................................................
[bugfix] insert absolute path to sys.path
insert absolute path to sys.path because sys.path[0], which is usual the absolute path, is overridden by os.path.dirname(filename) within run_python_file function
Bug: T249427 Change-Id: I7a16744bbc3998909ffd3b7bd633a92592259081 --- M HISTORY.rst M pwb.py 2 files changed, 4 insertions(+), 2 deletions(-)
Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst index a182023..40fa119 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,7 @@ Current release ---------------
+* Fix regression of combining sys.path in pwb.py wrapper (T249427) * pagengenerators.py no more support 'oursql' or 'MySQLdb'. It now solely support PyMySQL https://pypi.org/project/PyMySQL/ (T243154, T89976) * Bugfixes and improvements diff --git a/pwb.py b/pwb.py index 76018b3..e50d678 100755 --- a/pwb.py +++ b/pwb.py @@ -205,8 +205,9 @@ # or it is the absolute path for the directory of pwb.py absolute_path = abspath(os.path.dirname(sys.argv[0]))
-if absolute_path not in sys.path[:2]: - sys.path.insert(1, absolute_path) +# add absolute path because sys.path[0] is overridden +# with os.path.dirname(filename) within run_python_file +sys.path.insert(1, absolute_path)
if not check_modules(): sys.exit()