Strange problem ....

K

karthikbalaguru

Hi,

I am new to python, Kindly suggest to resolve a problem with a python
file.
What does the below error refer to ?
I use Redhat 9.0, python-2.2.2-26, python-devel-2.2.2-26 and
db4-4.0.14-20.

[root@localhost processor]# Analyzer processorcycle
/usr/local/SDK/bin/../core/bin/processorlib.py:8
8: Warning: 'yield' will become a reserved keyword in the future
Traceback (most recent call last):
File "/usr/local/SDK/bin/Analyzer", line 48, in ?
from debuglib import ProcessorInfo
File "/usr/local/SDK/bin/../core/bin/processorlib.py", line 88
yield ProcessorObjectInfo(child, self.pt)
^
SyntaxError: invalid syntax

Is this error related with the version of python / python-devel that i
use .
Any ideas / tips ?

Thx in advans,
Karthik Balaguru
 
S

Simon Brunning

2008/7/23 karthikbalaguru said:
I use Redhat 9.0, python-2.2.2-26, python-devel-2.2.2-26 and
db4-4.0.14-20.

File "/usr/local/SDK/bin/../core/bin/processorlib.py", line 88
yield ProcessorObjectInfo(child, self.pt)
^
SyntaxError: invalid syntax

Is this error related with the version of python / python-devel that i
use .
Any ideas / tips ?

Yup - generators (and hence the yield statement) were first introduced
in Python 2.2, but in order to maintain backward compatibility, you'll
need this line in any module using them:

from __future__ import generators

As of Python 2.3, this is no longer necessary, and I'd imagine that
whatever you are running was targeted at a post 2.2 release.

--
Cheers,
Simon B.
(e-mail address removed)
http://www.brunningonline.net/simon/blog/
GTalk: simon.brunning | MSN: small_values | Yahoo: smallvalues | Twitter: brunns
 
F

Francesco Bochicchio

Il Wed, 23 Jul 2008 01:19:48 -0700, karthikbalaguru ha scritto:
Hi,

I am new to python, Kindly suggest to resolve a problem with a python
file.
What does the below error refer to ?
I use Redhat 9.0, python-2.2.2-26, python-devel-2.2.2-26 and
db4-4.0.14-20.

[root@localhost processor]# Analyzer processorcycle
/usr/local/SDK/bin/../core/bin/processorlib.py:8 8: Warning: 'yield'
will become a reserved keyword in the future Traceback (most recent call
last):
File "/usr/local/SDK/bin/Analyzer", line 48, in ?
from debuglib import ProcessorInfo
File "/usr/local/SDK/bin/../core/bin/processorlib.py", line 88
yield ProcessorObjectInfo(child, self.pt)
^
SyntaxError: invalid syntax

Is this error related with the version of python / python-devel that i
use .

Yes. Generators (and thus the yield keyword) are not available in python
2.2.

Any ideas / tips ?

First try doing:
from __future__ import generators.
In __future__ package you can find the features which are to become
standard in the next releases. I don't remember when the generators have
been introduced but maybe you will be lucky.

Otherwhise install a newer version of python. You can probably do it
without replacing the one you have, but I'm not using RH and I can't
thell you how.

Thx in advans,
Karthik Balaguru

Ciao
 
D

Diez B. Roggisch

karthikbalaguru said:
Hi,

I am new to python, Kindly suggest to resolve a problem with a python
file.
What does the below error refer to ?
I use Redhat 9.0, python-2.2.2-26, python-devel-2.2.2-26 and
db4-4.0.14-20.

[root@localhost processor]# Analyzer processorcycle
/usr/local/SDK/bin/../core/bin/processorlib.py:8
8: Warning: 'yield' will become a reserved keyword in the future
Traceback (most recent call last):
File "/usr/local/SDK/bin/Analyzer", line 48, in ?
from debuglib import ProcessorInfo
File "/usr/local/SDK/bin/../core/bin/processorlib.py", line 88
yield ProcessorObjectInfo(child, self.pt)
^
SyntaxError: invalid syntax

Is this error related with the version of python / python-devel that i
use .
Any ideas / tips ?

I asked you yesterday why you are under the impression that your script is
destined for version 2.2. The above error proves: it is *not*. Why don't
you try running it with the installed version 2.4 or whatever fedora ships?

Diez
 
K

karthikbalaguru

Yup - generators (and hence the yield statement) were first introduced
in Python 2.2, but in order to maintain backward compatibility, you'll
need this line in any module using them:

from __future__ import generators

As of Python 2.3, this is no longer necessary, and I'd imagine that
whatever you are running was targeted at a post 2.2 release.

Your answers helped me to solve the problem.

I found some while loop inside def children(def).

I initially tried by putting 'from __future__ import generators'
just before the
def children(self):
present inside the class definition of 'DebugProcessorInfo'. But it
did not work.

Later i placed the 'from __future__ import generators' at the
beginning
of the python file and it worked sucessfully.

Thx for that info.
Karthik Balaguru
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top