On Fri, Jun 07, 2013 at 02:22:46AM +0200, Daniel Hofmann wrote: > 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') > > ^
This looks like you're using Python 3.2 to run Pyflakes on a source tree that was written for Python 2.x. u'unicode string literals' are invalid syntax on Python 3.0 through 3.2. Perhaps the error would be a bit clearer if the caret pointed to the beginning of the string literal, instead of the end. > > dslrpicontrol/__init__.py:28: 'dslrpicontrol' imported but unused Well, it is unused. You're merely importing it for the side effects (which is, generally speaking, a Bad Idea). In my pyflakes fork (which I intend to upstream Some Day Real Soon Now) I made pyflakes ignore unused imports if there's a comment on the line, with the intent that the comment explain why this unused import is here. E.g. import dslrpicontrol.loggers # for the side effects It doesn't look immediately upstreamable: http://bazaar.launchpad.net/~mgedmin/pyflakes/pyflakes-mg/revision/26 since it depends on my earlier changes that added command-line warning filtering: http://bazaar.launchpad.net/~mgedmin/pyflakes/pyflakes-mg/revision/22 http://bazaar.launchpad.net/~mgedmin/pyflakes/pyflakes-mg/revision/25 Marius Gedminas -- Users will less and less tolerate the risk of being attacked from anywhere in the universe. -- David Clark about network security, 1992
signature.asc
Description: Digital signature
_______________________________________________ code-quality mailing list code-quality@python.org http://mail.python.org/mailman/listinfo/code-quality