[Python-projects] crash: pylint name_of_a_nonexisting_file

Alexandre Fayolle alexandre.fayolle at logilab.fr
Thu Jul 24 08:56:29 CEST 2008


On Sat, Jul 19, 2008 at 09:26:34PM +0300, V.Chukharev wrote:
> Hi,
> 
> pylint crashes if a wrong filename (a nonexisting file) is given:
> 
> $ pylint name_of_a_nonexisting_file
> 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 901, 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 527, in expand_files
>     self.set_current_module(modname)
>   File "/usr/local/lib/python2.5/site-packages/pylint/lint.py", line 552, in set_current_module
>     self.stats['by_module'][modname] = {}
> TypeError: 'NoneType' object is unsubscriptable
> $ ls name_of_a_nonexisting_file
> ls: name_of_a_nonexisting_file: No such file or directory
> 
> I think this should be considered as a bug, as something similar
> to the message from ls is much easier to understand.

I agree that the message should be improved. However it is a bit more
complicated for pylint that for ls, since, if no file is found, pylint
tries to find a module on sys.path with the provided name. 

This issue has been added to our tracker[1] and will be fixed in the next
pylint release. Thanks for your bug report.  


[1] http://www.logilab.org/ticket/5634

-- 
Alexandre Fayolle                              LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Informatique scientifique:               http://www.logilab.fr/science
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: Digital signature
Url : http://lists.logilab.org/pipermail/python-projects/attachments/20080724/3f3317d9/attachment.pgp 


More information about the Python-Projects mailing list