Getting E999 SyntaxError on valid dict comprehension

Bug #1649693 reported by Maxime Simard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Pyflakes
Invalid
Undecided
Unassigned

Bug Description

Hi,

I keep getting that error in my code.

my_tool.py:1444:48: E999 SyntaxError: invalid syntax
        all_osd = {x: tmp_all_osd[x] for x in requested_list}
                                       ^

Can't figure out what is wrong here.
Python execute the line just fine and the result is as expected.

Using Python 2.7
pyflakes 1.3.0
flake8 3.2.1 (pyflakes: 1.3.0, flake8-comprehensions: 1.2.1, mccabe: 0.5.2, pycodestyle: 2.2.0) CPython 2.6.6 on Linux

Any insight?

Thanks a lot,

Max

Maxime Simard (msimard)
description: updated
affects: pyflakes → flake8
Revision history for this message
Ian Cordasco (icordasc) wrote :

Hi Max, a few things:

1. The correct issue tracker is https://gitlab.com/pycqa/flake8

2. Dictionary comprehensions were added in Python 2.7

3. To use the features of a specific version of Python, Flake8 needs to be installed using that version. In your bug report, it says you've installed on Python 2.6.6 so in fact the dictionary comprehension *is* invalid Syntax.

4. How in the world did you install Flake8 on Python 2.6? That shouldn't work. It uses features of Python 2.7 that aren't present in 2.6.

Changed in pyflakes:
status: New → Invalid
Revision history for this message
Maxime Simard (msimard) wrote :

Hi Ian,

Thanks for the quick feedback.
Sorry about not using the proper tracker.

The only thing I did is "pip install pyflakes/flake8".
Nothing else.

My Python version says 2.7.6, not 2.6.6.

I'll try to correct the installation.

Thanks,

Max

Ian Cordasco (icordasc)
no longer affects: flake8
Revision history for this message
Ian Cordasco (icordasc) wrote :

Max, your original comment here says:

"flake8 3.2.1 (pyflakes: 1.3.0, flake8-comprehensions: 1.2.1, mccabe: 0.5.2, pycodestyle: 2.2.0) CPython 2.6.6 on Linux"

So yes, you did install it on Python 2.6.6. You need to do `python2.7 -m pip install flake8` to get it to install on 2.7 for you (it would appear).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.