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 - search path incorrect search path incorrect
Status: RESOLVED DUPLICATE of bug 72680
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
All All
: Unprioritized normal
: ---
Assigned To: Mpaa
Depends on:
  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: ---


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

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/ 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:

Before it also checked cwd:
Comment 2 Merlijn van Deen (test) 2014-11-03 20:37:30 UTC
It's not about the cwd, but about the!

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

^ that explicitly set PYWIKIBOT2_DIR to the 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
os.path.split(__file__)[0] => /home/user/python/core/pywikibot

How it it supposed to know where 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 location to 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 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.