FeRDNYC created this task.
FeRDNYC added a project: Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
  Because the check for existence of a valid `user-config.py` file is performed 
immediately on import of the `pywikibot` module, and results in a fatal error 
if that check fails,  the check interferes with the ability to access the 
module documentation using `pydoc` in the absence of a configuration file or 
supported override:
  
    $ pip3 install --user pywikibot
    # Before
    $ pydoc3 pywikibot
    problem in pywikibot - RuntimeError: No user-config.py found in directory 
'/home/ferd/rpmbuild/REPOS/libopenshot/worktree-package/build/packaging/python/libopenshot'.
      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
        
    
    
    # After
    $ PYWIKIBOT_NO_USER_CONFIG=1 pydoc3 pywikibot
    Skipping loading of user-config.py.
    family and mylang are not set.
    Defaulting to family='wikipedia' and mylang='test'.
    Help on package pywikibot:
    
    NAME
        pywikibot - The initialization file for the Pywikibot framework.
    
    PACKAGE CONTENTS
        __metadata__
        _wbtypes
        bot
        bot_choice
        comms (package)
        config2
        cosmetic_changes
        daemonize
        data (package)
        date
        diff
        echo
        editor
        exceptions
        families (package)
        family
        fixes
        flow
        i18n
        interwiki_graph
        logentries
        logging
        login
        page (package)
        pagegenerators
        plural
        proofreadpage
        site (package)
        site_detect
        specialbots (package)
        textlib
        throttle
        titletranslate
        tools (package)
        userinterfaces (package)
        version
        xmlreader
    
    SUBMODULES
        config
    [...]
  
  Obviously, this is a low-severity issue as it can be worked around with 
little trouble by simply inserting `PYWIKIBOT_NO_USER_CONFIG=1` into the 
environment, or even just creating a dummy `user-config.py` file. The current 
behavior is little more than a paper cut.
  
  Still, it's one that will divide users into just two basic groups: either 
this issue becomes their very _first_ impression of `pywikibot`, or they never 
encounter it at all. If there's any way to put off the config-file check so 
that it's only performed when the module code is being **executed** (as opposed 
to merely imported) — or even just to special-case importing into the `pydoc` 
environment, specifically — it'd make the experience of the first group a bit 
more pleasant.

TASK DETAIL
  https://phabricator.wikimedia.org/T260646

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: FeRDNYC
Cc: Aklapper, pywikibot-bugs-list, FeRDNYC, JohnsonLee01, SHEKH, Dijkstra, 
Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, 
Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to