Page MenuHomePhabricator

pwb.py raises exception just before executing generate_user_files.py
Closed, ResolvedPublic

Description

$ python pwb.py
NOTE: 'user-config.py' was not found!
Traceback (most recent call last):
  File "pwb.py", line 186, in <module>
    import pywikibot  # noqa
  File "...pywikibot-core\pywikibot\__init__.py", line 37, in <module>
    from pywikibot import config2 as config
  File "...pywikibot-core\pywikibot\config2.py", line 338, in <module>
    _base_dir = get_base_dir()
  File "...pywikibot-core\pywikibot\config2.py", line 333, in get_base_dir
    raise RuntimeError(exc_text)
RuntimeError: No user-config.py found in directory '...pywikibot-core'.
  Please check that user-config.py is stored in the correct location.
  Directory where user-config.py is searched is determined as follows:

    Return the directory in which user-specific information is stored.

    This is determined in the following order:
     1.  If the script was called with a -dir: argument, use the directory
         provided in this argument.
     2.  If the user has a PYWIKIBOT2_DIR environment variable, use the value
         of it.
     3.  If user-config is present in current directory, use the current
         directory.
     4.  If user-config is present in pwb.py directory, use that directory
     5.  Use (and if necessary create) a 'pywikibot' folder under
         'Application Data' or 'AppData\Roaming' (Windows) or
         '.pywikibot' directory (Unix and similar) under the user's home
         directory.

    Set PYWIKIBOT2_NO_USER_CONFIG=1 to disable loading user-config.py

    @param test_directory: Assume that a user config file exists in this
        directory. Used to test whether placing a user config file in this
        directory will cause it to be selected as the base directory.
    @type test_directory: str or None
    @rtype: unicode


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pwb.py", line 190, in <module>
    if not filename.startswith('generate_'):
AttributeError: 'NoneType' object has no attribute 'startswith'

Running under Python 3.5.1 32-bit, Windows 10 64-bit, and the latest pwb version pulled from git repository.

Related Objects

Event Timeline

Dalba raised the priority of this task from to Needs Triage.
Dalba updated the task description. (Show Details)
Dalba added a project: Pywikibot.
Dalba added a subscriber: Dalba.
Dalba renamed this task from User-config generator raises exception: AttributeError: 'NoneType' object has no attribute 'startswith' to pwb.py raises exception just before executing generate_user_files.py.Dec 18 2015, 3:25 AM
Dalba set Security to None.

Change 260717 had a related patch set uploaded (by Hazard-SJ):
Prevent AttributeError for when filename is None

https://gerrit.wikimedia.org/r/260717

Change 260719 had a related patch set uploaded (by John Vandenberg):
Prevent AttributeError for when filename is None

https://gerrit.wikimedia.org/r/260719

Change 260717 merged by jenkins-bot:
Prevent AttributeError for when filename is None

https://gerrit.wikimedia.org/r/260717

Change 260719 merged by jenkins-bot:
Prevent AttributeError for when filename is None

https://gerrit.wikimedia.org/r/260719