No idea how to get deprecate warnings printed. -debug option does not work (anymore?)
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
[doc] Update README-conversion.txt and explain debugging level | pywikibot/core | master | +17 -10 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | Xqt | T106121 RFC removing old code / code cleanup | |||
Resolved | Xqt | T127998 Changing config.verbose_output value in the middle of a script does not affect how warnings are printed | |||
Invalid | Xqt | T132261 DeprecationWarning shown for Python 3 but not for Python 2 | |||
Resolved | Dalba | T164575 Invalid escape sequence in table2wiki.py for py3.6 |
Event Timeline
Seems this was deactivated with https://gerrit.wikimedia.org/r/187106 but there is no hint how to get warnings again. Neither -verbose nor -debug does it and I also didn't find anything in config file.
See also some remarks in T72970. I agree with Nullzero: Warnings should be showed always (default) and may be hidden by any settings.
Some scripts doesn't use handle_args to set debugging level. And where is the entry point for the shell?
For me deprecation warnings are printed in -verbose mode as expected, both in py2 and py3
One sample:
>>> import pwb, pywikibot as py >>> from pywikibot import config >>> config.verbose_output = 2 >>> s = py.Site() >>> p = py.User(s, '123.456.78.90') >>> p.isRegistered() False
expected behaviour:
>>> import pwb, pywikibot as py >>> from pywikibot import config >>> config.verbose_output = 2 >>> s = py.Site() >>> p = py.User(s, '123.456.78.90') >>> p.isRegistered() WARNING: pywikibot\data\api.py:2371: DeprecationWarning: Instead of using kwargs from Request.__init__, parameters for the request to the API should be added via the "parameters" parameter. kwargs = self.request_class.clean_kwargs(kwargs) WARNING: pywikibot\tools\ip.py:78: DeprecationWarning: ipaddress backport not available. warn('ipaddress backport not available.', DeprecationWarning) WARNING: pywikibot\tools\ip.py:79: DeprecationWarning: page.ip_regexp is deprecated; use tools.ip.is_IP instead. if ip_regexp.match(IP) is None: False >>>
My attempt, at least one of these is printed for me:
$ python pwb.py shell -verbose Pywikibot rede13695872939f4cedbb139bd03ead318ef64cb Python 3.6.4 (default, Dec 23 2017, 19:07:07) [GCC 7.2.1 20171128] Welcome to the Pywikibot interactive shell! >>> s=pywikibot.Site("cs") >>> w=pywikibot.User(s, '123.456.78.90') Found 1 wikipedia:cs processes running, including this one. >>> w.isRegistered() WARNING: /home/pavel/pywikibot/pywikibot/data/api.py:2371: DeprecationWarning: Instead of using kwargs from Request.__init__, parameters for the request to the API should be added via the "parameters" parameter. kwargs = self.request_class.clean_kwargs(kwargs) False
My second attempt, still in verbose mode, it seems there is some conflict or incorrect behavior between config and actual output:
>>> from pywikibot import config >>> config.verbose_output = 2 >>> w.isRegistered() False >>> config.verbose_output = 1 >>> w.isRegistered() False >>> config.verbose_output = 0 >>> w.isRegistered() False
As it stands, you should add verbose_output = 2 to user-config.py or pass it as a parameter on command line. Otherwise it won't go through init_handlers which configures warning filters.
Change 403424 had a related patch set uploaded (by Dalba; owner: Dalba):
[pywikibot/core@master] temporary for T127998
Change 403424 abandoned by Dalba:
temporary for T127998
Reason:
Fails on python 2. Did not check why.
Change 467411 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [doc] Update README-conversion.txt and explain debugging level
Change 467411 merged by jenkins-bot:
[pywikibot/core@master] [doc] Update README-conversion.txt and explain debugging level