[Python-projects] [patch] Handling non-existing files

V.Chukharev chukharev at mail.ru
Sun Nov 16 15:24:51 CET 2008


Hi,

If file 'tttt' does not exist, 'pylint tttt' gives the following.

$ pylint tttt
No config file found, using default configuration
Traceback (most recent call last):
  File "/usr/local/bin/pylint", line 4, in <module>
    lint.Run(sys.argv[1:])
  File "/usr/local/lib/python2.5/site-packages/pylint/lint.py", line 890, in __init__
    linter.check(args)
  File "/usr/local/lib/python2.5/site-packages/pylint/lint.py", line 457, in check
    filemods = self.expand_files(files_or_modules)
  File "/usr/local/lib/python2.5/site-packages/pylint/lint.py", line 517, in expand_files
    self.set_current_module(modname)
  File "/usr/local/lib/python2.5/site-packages/pylint/lint.py", line 543, in set_current_module
    self.stats['by_module'][modname] = {}
TypeError: 'NoneType' object is unsubscriptable
$ pylint --version
No config file found, using default configuration
pylint 0.15.1, 
astng 0.17.3, common 0.35.0
Python 2.5.2 (r252:60911, Sep  8 2008, 21:21:48) 
[GCC 4.2.1 20070719  [FreeBSD]]


With the attached one-line patch applied, a reasonable error message is given:

$ pylint tttt
No config file found, using default configuration
************* Module tttt
F:  1: No module named tttt

Best regards,
-- 
V. Chukharev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lint.py.patch
Type: application/octet-stream
Size: 450 bytes
Desc: not available
Url : http://lists.logilab.org/pipermail/python-projects/attachments/20081116/eaa36aaa/attachment.obj 


More information about the Python-Projects mailing list