[Python-apps-team] Bug#595020: pyflakes: reports unused imports in "import foo.bar; import foo as f; f.bar"

Jakub Wilk jwilk at debian.org
Tue Aug 31 12:58:07 UTC 2010


Package: pyflakes
Version: 0.4.0-1
Severity: normal

$ cat test.py 
import encodings.cp1250
import encodings as e
print e.cp1250

$ python test.py 
<module 'encodings.cp1250' from '/usr/lib/python2.6/encodings/cp1250.pyc'>

$ pyflakes test.py 
test.py:1: 'encodings' imported but unused

This is of course false positive; if I remove import from line 1, I get:

$ python test.py 
Traceback (most recent call last):
   File "test.py", line 2, in <module>
     print e.cp1250
AttributeError: 'module' object has no attribute 'cp1250'

-- 
Jakub Wilk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/python-apps-team/attachments/20100831/d0d7aace/attachment.pgp>


More information about the Python-apps-team mailing list