https://bugzilla.wikimedia.org/show_bug.cgi?id=55262
Web browser: --- Bug ID: 55262 Summary: -dir: paramter not working, variable _base_dir has unclear e Product: Pywikibot Version: unspecified Hardware: All OS: All Status: ASSIGNED Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: legoktm.wikipedia@gmail.com Classification: Unclassified Mobile Platform: ---
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1224/ Reported by: purodha Created on: 2010-08-22 21:57:45 Subject: -dir: paramter not working, variable _base_dir has unclear e Assigned to: purodha Original description: In the current svn verision (rev 8433) there is a huge mess around the parameter -dir. It is not processed in the place where all general parameters are - wikipedia.handleArgs() It is processed in wikipediatools an then deleted from the arguemnt list. Since this code is executed multiple times (e.g. 3 times in interwiki.py) it does different and unwanted things from the 2nd call on. We see repeated error messages about missing config files being created where there should be none. Login information is sought at the wrong place, requiring one to log in for each change made by interwiki.py, e.g.
config.py processed the -dir parameter and puts it into a variable _base_dir This variable is being used inconsistently as: - the directory where user_config is sought (only during the 1st trip through), - the directory where family configurations are expected, - the directory where programs are to be found, - the directory where where a .svn subdirectory is expected, which cannot be all identical if you are running multiple bots having to have different user_config.py files.
This all needs cleanup.
Since config data is processed before command line parameters are parsed, this is not straigthforward. When there can be a -dir parameter, config processing must not occur before it has been seen, or is known not to be used.
Since the current handling is not working anyways, and multiple processing is a waste anyways, I suggest to move the entire config handling to wikipedia.handleArgs() and make sure, it only happens once. This would likely obsolete most or all of the contents of wikipediatools.py
https://bugzilla.wikimedia.org/show_bug.cgi?id=55262
--- Comment #1 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- Here is a sample session - there is no config in /tmp/
user@A1A:~/files/pywikipedia$ python interwiki.py -dir:/tmp/ No user-config.py found in directory '/tmp/' Creating...
'user-config.py' already exists. Traceback (most recent call last): File "interwiki.py", line 337, in <module> import wikipedia as pywikibot File "/home/.../files/pywikipedia/wikipedia.py", line 143, in <module> from pywikibot import * File "/home/.../files/pywikipedia/pywikibot/__init__.py", line 15, in <module> from exceptions import * File "/home/.../files/pywikipedia/pywikibot/exceptions.py", line 13, in <module> import config File "/home/.../files/pywikipedia/config.py", line 90, in <module> for _filename in os.listdir(os.path.join(_base_dir, 'families')): OSError: [Errno 2] No such file or directory: '/tmp/families' user@A1A:~/files/pywikipedia$
https://bugzilla.wikimedia.org/show_bug.cgi?id=55262
Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://sourceforge.net/p/p | |ywikipediabot/bugs/1224
https://bugzilla.wikimedia.org/show_bug.cgi?id=55262
Nemo federicoleva@tiscali.it changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|General |interwiki.py
https://bugzilla.wikimedia.org/show_bug.cgi?id=55262
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEW CC| |info@gno.de
https://bugzilla.wikimedia.org/show_bug.cgi?id=55262
Amir Ladsgroup ladsgroup@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Priority|Unprioritized |Low CC| |ladsgroup@gmail.com Component|interwiki.py |General Version|unspecified |compat (1.0)
--- Comment #2 from Amir Ladsgroup ladsgroup@gmail.com --- Reproduced in compat, the code works perfectly fine in core though.
https://bugzilla.wikimedia.org/show_bug.cgi?id=55262
Ricordisamoa ricordisamoa@openmailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ricordisamoa@openmailbox.or | |g Summary|-dir: paramter not working, |-dir: parameter not |variable _base_dir has |working, variable _base_dir |unclear e |has unclear e
pywikipedia-bugs@lists.wikimedia.org