Page MenuHomePhabricator

No handlers could be found for logger "pywiki"
Closed, DeclinedPublic

Description

I get the No handlers could be found for logger "pywiki" message everytime I run pywikibot. I dont know what it means.

my version.py:

Pywikibot: [https] r-pywikibot-core.git (773e72e, g6572, 2015/09/25, 20:28:05, ok)
Release version: 2.0b3
requests version: 2.7.0
  cacerts: C:\Python27\lib\site-packages\requests\cacert.pem
    certificate test: ok
Python: 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]

Event Timeline

Wesalius raised the priority of this task from to Needs Triage.
Wesalius updated the task description. (Show Details)
Wesalius added a project: Pywikibot.
Wesalius subscribed.

I believe this is caused by recent changes to the process of logging & initialisation.
We still need to do a bit of related cleanup, including preventing this message from being displayed.

Just checking: Your bot doesnt break as a consequence of this message?

This happens when there is an error before logging is initialized in pywikibot.bot.init_handlers. Specifically, anything to do with configuration since pywikibot.config is imported before pywikibot.bot. Which also means that if there is any problem with user-config.py, it is silently ignored (and the bot does break, and the user has no idea why).

jayvdb triaged this task as High priority.Dec 12 2015, 7:29 PM

Either the user-config.py is missing or there is no mylang = '<language code>' assignment or the language code is invalid.

Xqt lowered the priority of this task from High to Low.Mar 8 2016, 7:34 PM

I suggest a warning should be printed.

Either the user-config.py is missing or there is no mylang = '<language code>' assignment or the language code is invalid.

There are some scenarios where that can be the cause, however this bug is about the problem explained by @Tgr above, and it is not easy to fix as it requires re-arranging the init process so the logger "pywiki" exists much earlier, or (more likely) adding a simple capturing logging handler on "pywiki" that can be played back when the real "pywiki" logger handler has been set up after the user config has been loaded.

Is this still happening? I tried removing mylang = '<language code>' assignment from user-config.py and also made a deliberate syntax error, but could not reproduce the issue. Does it happen only for specific scripts?

Is this a 2.0 branch issue?

The problem can not be reproduced. Feel free to reopen if you face it again in a recent version of pywikibot-core while providing more info.