line 629 of pyparser sets nonlocal variables limit and foundArity. In python 2.X nonlocal variables are read only and cannot be set. In the following lines setting them is attempted.
'decorator to trim function calls to match the arity of the target'
def _trim_arity(func, maxargs=3):
if func in singleArgBuiltins:
return lambda s,l,t: func(t)
limit = 0
foundArity = False
def wrapper(*args):
nonlocal limit,foundArity
while 1:
try:
ret = func(*args)
foundArity = True
return ret
except TypeError:
if limit == maxargs or foundArity:
raise
limit += 1
continue
return wrapper
Error i am seeing is:
File "/tmp/easy_install-7t56MV/pyparsing-2.0.0/pyparsing.py", line 629
nonlocal limit,foundArity
^
SyntaxError: invalid syntax
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's of course fine to have newer versions only support Python 3 but the way this change is introduced is probably breaking a lot of automatic testing code (like mine) that just uses the newest pyparsing version available. In addition, installation via "easy_install pyparsing" and "pip install pyparsing" is impossible on Python 2 and does not give any useful error message.
I'm not sure: Does pip take the package meta-data into account? If yes, removing "Programming Language :: Python" and only keeping "Programming Language :: Python :: 3" might prevent pip from trying to install it under python 2.
Either way, I think it would be a good idea to add a check to setup.py, something along the lines of:
if sys.hexversion <= 0x03000000:
raise Exception('This version of pyparsing requires Python 3, 1.5.7 is the last version supporting Python 2.')
Oh, and the README file still states:
"(pyparsing requires Python 2.3.2 or later.)"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
and the documentation for version 2.0.0 still list 2.3.2 as compatible. I had to come here to find out. Any place where we can download a previous version?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2013-04-04
If you tried to install the lastest version before, you need to clear the pip cache before trying to install a previous version
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the reminder - I'm checking in version 2.0.1 of pyparsing, which
will be compatible with Pythons 2.6 and 2.7 also.
-- Paul
From: Dan Gayle [mailto:dangayle@users.sf.net]
Sent: Monday, July 08, 2013 6:45 PM
To: [pyparsing:discussion]
Subject: [pyparsing:discussion] nonlocal doesn't worl with 2.X
pip install pyparsing==1.5.7
^ Doesn't work on Python 2.7.5
pip install pyparsing==1.5.6
^ Works
What's more concerning is that pyparsing is part of Celery's requirements,
and it borks on this error trying to install.
line 629 of pyparser sets nonlocal variables limit and foundArity. In python 2.X nonlocal variables are read only and cannot be set. In the following lines setting them is attempted.
'decorator to trim function calls to match the arity of the target'
def _trim_arity(func, maxargs=3):
if func in singleArgBuiltins:
return lambda s,l,t: func(t)
limit = 0
foundArity = False
def wrapper(*args):
nonlocal limit,foundArity
while 1:
try:
ret = func(*args)
foundArity = True
return ret
except TypeError:
if limit == maxargs or foundArity:
raise
limit += 1
continue
return wrapper
Error i am seeing is:
File "/tmp/easy_install-7t56MV/pyparsing-2.0.0/pyparsing.py", line 629
nonlocal limit,foundArity
^
SyntaxError: invalid syntax
Pyparsing 2.0.0 is for Python 3 only - latest pyparsing version for Python 2.x is 1.5.7.
To do this with easy_install, use the command "easy_install pyparsing==1.5.7"
Thanks for the information. Will alter my script to force 1.5.7.
It's of course fine to have newer versions only support Python 3 but the way this change is introduced is probably breaking a lot of automatic testing code (like mine) that just uses the newest pyparsing version available. In addition, installation via "easy_install pyparsing" and "pip install pyparsing" is impossible on Python 2 and does not give any useful error message.
I'm not sure: Does pip take the package meta-data into account? If yes, removing "Programming Language :: Python" and only keeping "Programming Language :: Python :: 3" might prevent pip from trying to install it under python 2.
Either way, I think it would be a good idea to add a check to setup.py, something along the lines of:
Oh, and the README file still states:
"(pyparsing requires Python 2.3.2 or later.)"
I am unable to install the 1.5.7 release with pip :
It's like the 1.5.7 release was overwritten by the new version ?
Same problem over here, I cannot install with
and the documentation for version 2.0.0 still list 2.3.2 as compatible. I had to come here to find out. Any place where we can download a previous version?
If you tried to install the lastest version before, you need to clear the pip cache before trying to install a previous version
I see http://www.2gather.in/?p=98
And solved this with
^ Doesn't work on Python 2.7.5
^ Works
What's more concerning is that pyparsing is part of Celery's requirements, and it borks on this error trying to install.
Last edit: Dan Gayle 2013-07-08
Thanks for the reminder - I'm checking in version 2.0.1 of pyparsing, which
will be compatible with Pythons 2.6 and 2.7 also.
-- Paul
From: Dan Gayle [mailto:dangayle@users.sf.net]
Sent: Monday, July 08, 2013 6:45 PM
To: [pyparsing:discussion]
Subject: [pyparsing:discussion] nonlocal doesn't worl with 2.X
pip install pyparsing==1.5.7
^ Doesn't work on Python 2.7.5
pip install pyparsing==1.5.6
^ Works
What's more concerning is that pyparsing is part of Celery's requirements,
and it borks on this error trying to install.
nonlocal doesn't worl with 2.X
https://sourceforge.net/p/pyparsing/discussion/337293/thread/fa00ffd7/?limi t=25#2ce7
Sent from sourceforge.net because you indicated interest in
https://sourceforge.net/p/pyparsing/discussion/337293/
To unsubscribe from further messages, please visit
https://sourceforge.net/auth/subscriptions/