[Tutor] PyChecker: Installing and or Using

Kent Johnson kent37 at tds.net
Thu Aug 11 13:55:20 CEST 2005


Dick Moores wrote:
> It appears to me that I've found a bug in PyChecker (see below). Am I 
> correct?
> Warning (from warnings module):
>     File "C:\Python24\lib\site-packages\pychecker\checker.py", line 609
>       m = imp.init_builtin(moduleName)
> DeprecationWarning: the regex module is deprecated; please use the re module
> 
> That line 609 is in this function in checker.py:
> 
> def fixupBuiltinModules(needs_init=0):
>       for moduleName in sys.builtin_module_names :
>           if needs_init:
>               _ = Module(moduleName, 0)
>           module = _allModules.get(moduleName, None)
>           if module is not None :
>               try :
>                   m = imp.init_builtin(moduleName)
>               except ImportError :
>                   pass
>               else :
>                   extra_attrs = _BUILTIN_MODULE_ATTRS.get(moduleName, [])
>                   module.attributes = [ '__dict__' ] + dir(m) + extra_attrs
> 
>   >>> import sys
>   >>> sys.builtin_module_names
> ('__builtin__', '__main__', '_bisect', '_codecs', '_codecs_cn',
> '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr',
> '_codecs_tw', '_csv', '_heapq', '_hotshot', '_locale', '_multibytecodec',
> '_random', '_sre', '_subprocess', '_symtable', '_weakref', '_winreg',
> 'array', 'audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath',
> 'collections', 'datetime', 'errno', 'exceptions', 'gc', 'imageop', 'imp',
> 'itertools', 'marshal', 'math', 'md5', 'mmap', 'msvcrt', 'nt',
> 'operator', 'parser', 'regex', 'rgbimg', 'sha', 'signal', 'strop',
> 'struct', 'sys', 'thread', 'time', 'xxsubtype', 'zipimport')
>   >>>
> 
> What now?

It's just a warning so you can go ahead and use PyChecker. It's hard to call this a bug in PyChecker since it isn't explicitly referring to the regex module; for some reason it is importing all the builtin modules and adding a list of names to the module.

It would be nice if PyChecker trapped the warning and didn't show it. There is already a bug report filed on sourceforge - http://sourceforge.net/tracker/index.php?func=detail&aid=1236534&group_id=24686&atid=382217 - so I would ignore it and move on.

Kent



More information about the Tutor mailing list