Last modified: 2014-11-08 22:06:24 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T74918, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 72918 - pwb.py user-config.py search path incorrect
pwb.py user-config.py search path incorrect
Status: RESOLVED DUPLICATE of bug 72680
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
core-(2.0)
All All
: Unprioritized normal
: ---
Assigned To: Mpaa
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-11-03 20:16 UTC by Merlijn van Deen (test)
Modified: 2014-11-08 22:06 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Merlijn van Deen (test) 2014-11-03 20:16:18 UTC
The search path was:

PYWIKIBOT2_DIR, (pwb directory)

and is now

PYWIKIBOT2_DIR, ., ~/.pywikibot,

(changed in https://github.com/wikimedia/pywikibot-core/commit/3a1ba465c74af95e52e5312f5c5dd5f2c43c3e8b#diff-439f77fba033e329e68235a823736fc3R162)

which is the same if we are in the pwb directory, but not if this is not the case! This is e.g. often the case with jsub commands such as

jsub python /data/project/some/path/pwb.py scriptname

which is expected to use the user-config in /data/project/some/path, not the user-config in /data/project/.pywikibot/


The search order should probably be adapted to PYWIKIBOT2_DIR, ., pwb dir, ~/.pywikibot.
Comment 1 Fabian 2014-11-03 20:35:46 UTC
I don't see how the linked commit does change the load order. I'm pretty sure that it's because of my rewrite:

https://github.com/wikimedia/pywikibot-core/commit/41c7eb19fd3fb6f4c3ade896b5fb37ab21e1958d#diff-1

Before it also checked cwd:

https://github.com/wikimedia/pywikibot-core/blob/0d6a3d724a2bf7068ec0e4baa3bab2bb65648bf0/pywikibot/config2.py
Comment 2 Merlijn van Deen (test) 2014-11-03 20:37:30 UTC
It's not about the cwd, but about the directory-pwb.py-is-in!

https://github.com/wikimedia/pywikibot-core/commit/3a1ba465c74af95e52e5312f5c5dd5f2c43c3e8b#diff-f15f62388b2fa48d5a3f9f09dbafceffL146

-if "PYWIKIBOT2_DIR" not in os.environ:
-    os.environ["PYWIKIBOT2_DIR"] = os.path.split(__file__)[0]


^ that explicitly set PYWIKIBOT2_DIR to the pwb.py dir if it was not set before.
Comment 3 John Mark Vandenberg 2014-11-04 03:53:24 UTC
Probably a dup of bug 72680
Comment 4 Mpaa 2014-11-08 22:01:27 UTC
Now the logic is in config2.py.
os.path.split(__file__)[0] => /home/user/python/core/pywikibot

How it it supposed to know where pwb.py is?
Is it safe enough to assume assume ../pywikibot?
Comment 5 Merlijn van Deen (test) 2014-11-08 22:06:24 UTC
Indeed duplicate.


We can either pass the pwb.py location to config2.py somehow (environment variable, maybe some global variable? not sure), or just use '..', which should be fine in most cases. Maybe we should check whether there actually is a pwb.py in that directory to be sure we're not installed.

*** This bug has been marked as a duplicate of bug 72680 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links