Can anyone explain why I get the following syntax error when running the setup.py install:
Exception
SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/cardstream/payment.py', 46, 15, ' for key, value in parse_qs(query).items()\n'))
Code
@classmethod
def decode(this, query):
"""Decode a request/response from the given query string.
"""
return {
key: value if len(value) > 1 else value[0]
for key, value in parse_qs(query).items()
}
The line it refers to is the for. I'm familiar with Python, but not so much that I can figure out why it's moaning.
Edit For completeness, here is the exception when the script is run manually:
[...pythonsdk]$ python test/test_gateway.py
Traceback (most recent call last):
File "test/test_gateway.py", line 4, in <module>
from REMOVED.payment import Gateway
File "/usr/lib/python2.6/site-packages/REMOVED-0.0.1-py2.6.egg/REMOVED/payment.py", line 46
for key, value in parse_qs(query).items()
^
SyntaxError: invalid syntax