Hello Daniel,

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).

Because Pyflakes is based on the AST module from the standard library,
it is dependent on the version of Python.
See also: https://bugs.launchpad.net/pyflakes/+bug/1169552

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.
http://docs.python.org/2/tutorial/modules.html#importing-from-a-package

The related issue, with details https://bugs.launchpad.net/pyflakes/+bug/1178905


Best regards,

--
Florent Xicluna

2013/6/7 Daniel Hofmann <dan...@trvx.org>:
> I tried reaching someone from Pyflakes in the IRC channel on
> freenode and was kindly redirected to this mailinglist, so please
> tell me if this is not the appropriate place for my questions.
>
>
> I discovered Pyflakes a few weeks ago and I'm using it in a project.
> But it seems that I'm not able to get rid of a few errors it reports.
>
> I'm by no means a Python professional, so this may be a mistake on my side.
>
> The following three error messages do not make sense for me:
>
>> dslrpicontrol/models.py:26: invalid syntax
>>        flash(u'Auto-detection request failed', 'danger')
>>                                              ^
>> dslrpicontrol/errorhandlers.py:15: invalid syntax
>>     return render_error(404, u'Page not found')
>>                                              ^
>> dslrpicontrol/__init__.py:28: 'dslrpicontrol' imported but unused
>
> If you want to see the specific position, I hilighted the exact lines here:
>
>> https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/models.py#L26
>> https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/errorhandlers.py#L15
>> https://github.com/daniel-j-h/dslr-pi-control/blob/master/dslrpicontrol/__init__.py#L28
>
> The first two 'invalid syntax' error reports do not make sense to me.
> Why is the syntax invalid? The Python interpreter does The Right Thing.
>
> More about the flash() function here:
>> http://flask.pocoo.org/docs/patterns/flashing/#flashing-with-categories
>> http://flask.pocoo.org/docs/api/#message-flashing
>
> The last 'imported but unused' error report probably comes from the circular 
> imports?
> This idiom was actually recommended by the Flask docs. Is this also a false 
> positive?
>
> I'm glad for any hints.
>
> Cheers,
> Daniel
> _______________________________________________
> code-quality mailing list
> code-quality@python.org
> http://mail.python.org/mailman/listinfo/code-quality
_______________________________________________
code-quality mailing list
code-quality@python.org
http://mail.python.org/mailman/listinfo/code-quality

Reply via email to