Bugs item #3051034, was opened at 2010-08-22 21:57 Message generated for change (Comment added) made by purodha You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3051034...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: General Group: None Status: Open Resolution: None Priority: 7 Private: No Submitted By: Purodha B Blissenbach (purodha) Assigned to: Purodha B Blissenbach (purodha) Summary: -dir: paramter not working, variable _base_dir has unclear e
Initial Comment: 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
----------------------------------------------------------------------
Comment By: Purodha B Blissenbach (purodha)
Date: 2010-08-26 11:58
Message: 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$
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3051034...