[New-bugs-announce] [issue22543] -W option cannot use non-standard categories

Rémi Rampin report at bugs.python.org
Thu Oct 2 23:32:00 CEST 2014

New submission from Rémi Rampin:

warnings._processoptions is called very early, before site-packages are enabled. Because of this, using a non-standard 'category' will almost certainly fail with the message:

    Invalid -W option ignored: invalid module name: '...'

The -W option would be a lot more useful if it could actually match non-standard categories (it does, after all, pretend to support modulename.classname).

I don't see any easy way of fixing this, other than initializing the warnings module later or matching category names with the given string (and getting rid of the import).

components: Library (Lib)
messages: 228261
nosy: remram
priority: normal
severity: normal
status: open
title: -W option cannot use non-standard categories
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list