Strange problem ....

Discussion in 'Python' started by karthikbalaguru, Jul 23, 2008.

  1. 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
    karthikbalaguru, Jul 23, 2008
    #1
    1. Advertising

  2. 2008/7/23 karthikbalaguru <>:
    > 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.

    http://www.brunningonline.net/simon/blog/
    GTalk: simon.brunning | MSN: small_values | Yahoo: smallvalues | Twitter: brunns
    Simon Brunning, Jul 23, 2008
    #2
    1. Advertising

  3. 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
    -----
    FB
    Francesco Bochicchio, Jul 23, 2008
    #3
  4. karthikbalaguru wrote:

    > 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
    Diez B. Roggisch, Jul 23, 2008
    #4
  5. On Jul 23, 1:31 pm, "Simon Brunning" <> wrote:
    > 2008/7/23 karthikbalaguru <>:
    >
    > > 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.
    >


    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
    karthikbalaguru, Jul 23, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kload

    Strange Timing Problem

    Kload, Oct 23, 2003, in forum: VHDL
    Replies:
    2
    Views:
    567
    Kload
    Oct 23, 2003
  2. Akshaye
    Replies:
    1
    Views:
    712
    Hemant Gupta
    Feb 9, 2004
  3. Pedro Miguel Carvalho
    Replies:
    2
    Views:
    1,107
    Pedro Miguel Carvalho
    Oct 25, 2004
  4. Harvey Twyman
    Replies:
    8
    Views:
    542
    August Derleth
    Oct 25, 2003
  5. championsleeper
    Replies:
    0
    Views:
    562
    championsleeper
    Jan 26, 2005
Loading...

Share This Page