Page MenuHomePhabricator

pywikibot configuration does not work
Closed, ResolvedPublic

Description

I followed the steps in :wikitech:Help:Toolforge/Pywikibot#Using_the_shared_Pywikibot_files_(recommended_setup).

But when I run
tools.tool@tools-login$ python /data/project/shared/pywikibot/core/generate_user_files.py
I get

tools.svgworkaroundbot@tools-sgebastion-07:~$ python /data/project/shared/pywikibot/core/generate_user_files.py
Traceback (most recent call last):
  File "/data/project/shared/pywikibot/core/generate_user_files.py", line 21, in <module>
    from pywikibot.tools import file_mode_checker
  File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core/pywikibot/__init__.py", line 24, in <module>
    from pywikibot.bot import (
  File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core/pywikibot/bot.py", line 98, in <module>
    from pywikibot import config2 as config
  File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core/pywikibot/config2.py", line 392, in <module>
    base_dir = get_base_dir()
  File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core/pywikibot/config2.py", line 386, in get_base_dir
    raise RuntimeError(exc_text)
RuntimeError: No user-config.py found in directory '/mnt/nfs/labstore-secondary-tools-project/svgworkaroundbot'.
  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 PYWIKIBOT_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 PYWIKIBOT_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: str

tools.svgworkaroundbot@tools-sgebastion-07:~$

Zhuyifei1999 wrote at https://commons.wikimedia.org/wiki/User_talk:SVGWorkaroundBot#Pywikibot

This looks like a bug from some recent pywikibot change.

Details

Related Gerrit Patches:

Event Timeline

Restricted Application added a subscriber: pywikibot-bugs-list. · View Herald TranscriptMar 31 2019, 9:20 PM
Xqt triaged this task as High priority.Apr 1 2019, 4:34 AM
Xqt added a subscriber: Xqt.

Change 500389 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] Revert "[bugfix] Fix error thrown on saving user-passwords.py"

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

Xqt closed this task as Resolved.Apr 1 2019, 7:56 AM
Xqt claimed this task.

Change 500389 merged by jenkins-bot:
[pywikibot/core@master] Revert "[bugfix] Fix error thrown on saving user-passwords.py"

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