[code-quality] Possible false positives in Pyflakes

Daniel Hofmann daniel at trvx.org
Fri Jun 7 12:12:52 CEST 2013


Thanks for your quick and detailed description!

On 08:21 Fri 07 Jun     , Florent wrote:
> you see the syntax issue because you installed Pyflakes for Python 3.1
> or 3.2, and you are checking code which is syntactically wrong for
> these versions of Python (The u"" prefix is only supported with Python
> 2.x or Python >= 3.3).

Oh, that's true, my system's Pyflakes is installed for Python 3.
But I'm wondering a bit, because my virtualenv is Pythpn 2 only.
And even after activating it, it seems that it is calling the global
Pyflakes:
> (env)$ pyflakes dslrpicontrol
> (unicode literal errors here)

Although my PATH got the virtualenv's bin directory at first position:
> (env)$ echo $PATH
> /home/daniel/dslr-pi-control/env/bin:/usr/local/sbin:/usr/local/bin:....

So it seems I have to call it like
> (env)$ ./env/bin/pyflakes dslrpicontrol
To get the right one?

Isn't it virtualenv's task to use the one from the environment?


> The last case, about unused import, could be seen as a false positive.
> Usually you can get rid of the warning if you declare these __init__
> imports in the special __all__ variable.

Will do! Thanks!


More information about the code-quality mailing list