Syntax error after upgrading to Python 2.4

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • frr@easyjob.net

    Syntax error after upgrading to Python 2.4

    Hi,

    After upgrading to 2.4 (from 2.3), I'm getting a weird syntax error:
    [color=blue][color=green][color=darkred]
    >>> import themes[/color][/color][/color]
    Traceback (most recent call last):
    File "<interacti ve input>", line 1, in ?
    File "themes.py" , line 564
    font = self.font.makeB lackAndWhite(),
    additive = self.additive,
    ^
    SyntaxError: invalid syntax

    The relevant code is:

    def makeBlackAndWhi te( self ):

    return CharStyle( names = self.names,
    basedOn = self.basedOn.ma keBlackAndWhite (),
    font = self.font.makeB lackAndWhite(),
    additive = self.additive,
    prefixText = self.prefixText )

    This is a method in the CharStyle class which returns a new modified
    instance of CharStyle.

    I'm using Windows XP and Python 2.4.1

    Any ideas? O:-)

  • Terry Reedy

    #2
    Re: Syntax error after upgrading to Python 2.4


    <frr@easyjob.ne t> wrote in message
    news:1123260862 .672051.282940@ z14g2000cwz.goo glegroups.com.. .[color=blue]
    > After upgrading to 2.4 (from 2.3), I'm getting a weird syntax error:
    >[color=green][color=darkred]
    >>>> import themes[/color][/color]
    > Traceback (most recent call last):
    > File "<interacti ve input>", line 1, in ?
    > File "themes.py" , line 564
    > font = self.font.makeB lackAndWhite(),
    > additive = self.additive,
    > ^
    > SyntaxError: invalid syntax[/color]

    The location of the caret is sometimes misleading, especially with
    proportional fonts...
    [color=blue]
    > The relevant code is:
    >
    > def makeBlackAndWhi te( self ):
    >
    > return CharStyle( names = self.names,
    > basedOn = self.basedOn.ma keBlackAndWhite (),
    > font = self.font.makeB lackAndWhite(),
    > additive = self.additive,
    > prefixText = self.prefixText )
    >
    > This is a method in the CharStyle class which returns a new modified
    > instance of CharStyle.
    >
    > I'm using Windows XP and Python 2.4.1
    >
    > Any ideas? O:-)[/color]

    I don't see the problem yet. I certainly do not see anything that should
    have been affected by the upgrade (was it from 2.3 on XP also?)

    After checking for nonprinting chars, I would shuffle the param-default
    lines to try to determine which is really at fault. Good luck, or wait for
    a more helpful response.

    Terry J. Reedy



    Comment

    • Fernando

      #3
      Re: Syntax error after upgrading to Python 2.4

      > I don't see the problem yet. I certainly do not see anything that should[color=blue]
      > have been affected by the upgrade (was it from 2.3 on XP also?)[/color]

      Yes.
      [color=blue]
      > After checking for nonprinting chars, I would shuffle the param-default
      > lines to try to determine which is really at fault. Good luck, or wait for
      > a more helpful response.[/color]

      I reinstalled version 2.3.5 and everything works fine now. It's
      definately something related to the latest version.

      <rant>
      This is one of the main resons I finally gave up using Python and
      switched to Smalltalk. You can't concentrate on your work while someone
      is permanently introducing changes to your tool.

      Constantly adding new features to a language might be fun, but it
      substantially increases the odds of adding bugs and misfeatures, such
      as whatever was causing problems with my code or the 'perlish' syntax
      for decorators.
      </rant>

      Feeling much better now. :-)

      Comment

      • Peter Hansen

        #4
        Re: Syntax error after upgrading to Python 2.4

        Fernando wrote:[color=blue]
        > I reinstalled version 2.3.5 and everything works fine now. It's
        > definately something related to the latest version.[/color]

        No problem in software is definite until you actually know what the
        solution is. I'd suspect something other than a simple problem in 2.4
        itself, since otherwise it is highly likely others would already have
        encountered it.

        Since a SyntaxError is raised during compilation (during import) and not
        execution, it should be possible to get that even on another machine
        without all the related code. Care to email me a copy of that file and
        I'll investigate it for you? I have both 2.3 and 2.4 installed and it
        shouldn't take long for me to figure out what the problem is, or at
        least to prove that it is not a 2.4 issue. If you can't do that, try
        removing all the code except the "class" line and that one method in the
        class. It should still give a syntax error for the same line.
        [color=blue]
        > <rant>
        > This is one of the main resons I finally gave up using Python and
        > switched to Smalltalk. You can't concentrate on your work while someone
        > is permanently introducing changes to your tool.[/color]

        Python has one of the absolute best backwards-compatibility records in
        the history of software, IMHO. While I can't offer a comparison with
        Smalltalk, I really doubt Smalltalk has been (or could be) significantly
        better unless it hasn't changed at all in 30 years...

        Still, someone has to be the first to find each bug, and maybe you've
        discovered one in 2.4. Let me have that file (or a reduced version of
        it that still generates the problem) and I'll prove one of us wrong. :-)

        -Peter

        Comment

        • John Machin

          #5
          Re: Syntax error after upgrading to Python 2.4

          Fernando wrote:[color=blue][color=green]
          >>I don't see the problem yet. I certainly do not see anything that should
          >>have been affected by the upgrade (was it from 2.3 on XP also?)[/color]
          >
          >
          > Yes.
          >
          >[color=green]
          >>After checking for nonprinting chars, I would shuffle the param-default
          >>lines to try to determine which is really at fault. Good luck, or wait for
          >>a more helpful response.[/color]
          >
          >
          > I reinstalled version 2.3.5[/color]

          You didn't need to remove it in the first place.
          [color=blue]
          > and everything works fine now. It's
          > definately something related to the latest version.[/color]

          Oh? Did you check for nonprinting chars, as advised?
          [color=blue]
          >
          > <rant>
          > This is one of the main resons I finally gave up using Python[/color]

          Huh? You're still here, still using it, ...
          [color=blue]
          > and
          > switched to Smalltalk. You can't concentrate on your work while someone
          > is permanently introducing changes to your tool.[/color]

          Well stick with Python 2.3.5 then!!
          [color=blue]
          >
          > Constantly adding new features to a language might be fun, but it
          > substantially increases the odds of adding bugs and misfeatures, such
          > as whatever was causing problems with my code or the 'perlish' syntax
          > for decorators.
          > </rant>[/color]

          Or switch to (e.g.) Sather; no funsters adding bugs & misfeatures to
          that sucker :-)
          [color=blue]
          >
          > Feeling much better now. :-)
          >[/color]

          I hope so ...

          Comment

          • Terry Reedy

            #6
            Re: Syntax error after upgrading to Python 2.4


            "Fernando" <frr@easyjob.ne t> wrote in message
            news:1123323206 .151000.309140@ g49g2000cwa.goo glegroups.com.. .

            I wrote[color=blue][color=green]
            >> I don't see the problem yet. I certainly do not see anything that
            >> should
            >> have been affected by the upgrade (was it from 2.3 on XP also?)[/color]
            > Yes.[/color]

            and[color=blue][color=green]
            >> After checking for nonprinting chars, I would shuffle the param-default
            >> lines to try to determine which is really at fault. Good luck, or wait
            >> for
            >> a more helpful response.[/color][/color]

            Did you try either of these.
            [color=blue]
            > I reinstalled version 2.3.5 and everything works fine now. It's
            > definately something related to the latest version.[/color]

            Yes and no. Sometimes fixing implementation bugs, which was half the
            effort in 2.4 and all the effort in 2.4.1, exposes bugs in program code.
            Sometimes installations have bugs not in the version itself. Or the OS has
            bugs, or faults in the particular installation. Perhaps you needed to
            reinstall 2.4.1.
            [color=blue]
            > <rant>[/color]
            ....[color=blue]
            > Constantly adding new features to a language might be fun, but it
            > substantially increases the odds of adding bugs and misfeatures, such
            > as whatever was causing problems with my code or the 'perlish' syntax
            > for decorators.
            > </rant>[/color]

            At the moment, we *do not know* that your problem has *anything* with new
            features added in 2.4. And we won't unless you help the community effort
            to improve Python. So I won't take what you said too seriously.

            In any case letting developers add new features is part of the price of
            getting unpaid bug fixes for free software. But note that PSF does not
            make you to upgrade. Here is the current list of possible downloads.

            Python 2.4.1 (March 30, 2005)
            Python 2.4 (November 30, 2004)
            Python 2.3.5 (February 8, 2005)
            Python 2.2.3 (May 30, 2003)
            Python 2.1.3 (April 8, 2002)
            Python 2.0.1 (June 2001)
            Python 1.6.1 (September 2000)
            Python 1.5.2 (April 1999)
            [color=blue]
            > Feeling much better now. :-)[/color]

            I'm not.

            Terry J. Reedy



            Comment

            • jepler@unpythonic.net

              #7
              Re: Syntax error after upgrading to Python 2.4

              On Sat, Aug 06, 2005 at 05:15:22PM -0400, Terry Reedy wrote:[color=blue]
              > In any case letting developers add new features is part of the price of
              > getting unpaid bug fixes for free software. But note that PSF does not
              > make you to upgrade. Here is the current list of possible downloads.
              > [/color]
              [a mere 8 versions]

              Oh, don't give such a short list! Here's what I found on the python.org ftp site:

              # in /pub/python (most with a set of a/b/rc tarballs too)
              drwxrwsr-x 2 1004 1004 512 Aug 23 2001 2.0
              drwxrwsr-x 3 1004 1004 512 Aug 06 2001 2.0.1
              drwxrwsr-x 3 1004 1004 512 Aug 06 2001 2.1
              drwxrwsr-x 4 1004 1004 512 Aug 16 2001 2.1.1
              drwxrwsr-x 4 1010 1004 512 Feb 08 2002 2.1.2
              drwxrwsr-x 3 1010 1004 512 Apr 23 2002 2.1.3
              drwxrwsr-x 5 1004 1004 512 Apr 23 2002 2.2
              drwxrwsr-x 4 1015 1004 512 Apr 23 2002 2.2.1
              drwxrwsr-x 4 1005 1004 512 Aug 06 2003 2.2.2
              drwxrwsr-x 4 1004 1004 512 Jun 13 2003 2.2.3
              drwxrwsr-x 4 1005 1004 512 Dec 16 2004 2.3
              drwxrwsr-x 4 1010 1004 512 Sep 24 2003 2.3.1
              drwxrwxr-x 4 1010 1004 512 Oct 18 2003 2.3.2
              drwxrwxr-x 4 1010 1004 512 Feb 03 2004 2.3.3
              drwxrwxr-x 4 1010 1004 512 May 27 2004 2.3.4
              drwxrwxr-x 4 1010 1004 512 Mar 20 22:35 2.3.5
              drwxrwxr-x 4 1010 1004 512 Nov 30 2004 2.4
              drwxrwxr-x 4 1010 1004 512 Apr 03 08:10 2.4.1

              # in /pub/python/src
              -rw-rw-r-- 1 1005 1004 1907724 Dec 26 2001 python-1.2.tar.gz
              -rw-rw-r-- 1 1005 1004 2037062 Dec 26 2001 python-1.3.tar.gz
              -rw-rw-r-- 1 1005 1004 2252481 Dec 26 2001 python-1.4.tar.gz
              -rw-rw-r-- 1 1005 1004 2259957 Dec 26 2001 python-1.5.1.tar.gz
              -rw-rw-r-- 1 1005 1004 2533053 Dec 26 2001 python-1.5.2.tar.gz
              -rw-rw-r-- 1 1005 1004 2465663 Dec 26 2001 python-1.5.2b1.tar.gz
              -rw-rw-r-- 1 1005 1004 2515142 Dec 26 2001 python-1.5.2b2.tar.gz
              -rw-rw-r-- 1 1005 1004 2543715 Dec 26 2001 python-1.5.2c1.tar.gz
              -rw-rw-r-- 1 1005 1004 2904353 Dec 26 2001 python-1.5.tar.gz
              -rw-rw-r-- 1 1005 1004 4114315 Dec 26 2001 python-1.6.tar.gz
              -rw-rw-r-- 1 1005 1004 3784124 Dec 26 2001 python-1.6b1.tar.gz
              -rw-rw-r-- 1 1005 1004 4066781 Dec 26 2001 python-2.0.tar.gz
              -rw-rw-r-- 1 1005 1004 4178895 Dec 26 2001 python-2.0b1.tar.gz
              -rw-rw-r-- 1 1005 1004 3962932 Dec 26 2001 python-2.0b2.tar.gz
              -rw-rw-r-- 1 1005 1004 3997787 Dec 26 2001 python-2.0c1.tar.gz
              -rw-rw-r-- 1 1005 1004 1137661 Mar 19 2002 python1.0.1.tar .gz
              -rw-rw-r-- 1 1005 1004 1465876 Mar 19 2002 python1.1.tar.g z

              And then there's CVS...

              Jeff

              -----BEGIN PGP SIGNATURE-----
              Version: GnuPG v1.2.6 (GNU/Linux)

              iD8DBQFC9Us8Jd0 1MZaTXX0RAnZBAJ 9QjHP3GFcy7gEZh n55xYuV2HjipACf ZbVd
              HD7W5JPMzhMVtad Shx50Q7M=
              =NLSq
              -----END PGP SIGNATURE-----

              Comment

              • Michael Hudson

                #8
                Re: Syntax error after upgrading to Python 2.4

                jepler@unpython ic.net writes:
                [color=blue]
                > On Sat, Aug 06, 2005 at 05:15:22PM -0400, Terry Reedy wrote:[color=green]
                >> In any case letting developers add new features is part of the price of
                >> getting unpaid bug fixes for free software. But note that PSF does not
                >> make you to upgrade. Here is the current list of possible downloads.
                >>[/color]
                > [a mere 8 versions]
                >
                > Oh, don't give such a short list! Here's what I found on the python.org ftp site:[/color]

                [...]
                [color=blue]
                > And then there's CVS...[/color]

                Which doesn't build for the really early versions. I think
                python1.0.1.tar .gz is as old as it's easy to get.

                Cheers,
                mwh

                --
                Ignoring the rules in the FAQ: 1" slice in spleen and prevention
                of immediate medical care.
                -- Mark C. Langston, asr

                Comment

                • Reinhold Birkenfeld

                  #9
                  Re: Syntax error after upgrading to Python 2.4

                  Michael Hudson wrote:[color=blue]
                  > jepler@unpython ic.net writes:
                  >[color=green]
                  >> On Sat, Aug 06, 2005 at 05:15:22PM -0400, Terry Reedy wrote:[color=darkred]
                  >>> In any case letting developers add new features is part of the price of
                  >>> getting unpaid bug fixes for free software. But note that PSF does not
                  >>> make you to upgrade. Here is the current list of possible downloads.
                  >>>[/color]
                  >> [a mere 8 versions]
                  >>
                  >> Oh, don't give such a short list! Here's what I found on the python.org ftp site:[/color]
                  >
                  > [...]
                  >[color=green]
                  >> And then there's CVS...[/color]
                  >
                  > Which doesn't build for the really early versions. I think
                  > python1.0.1.tar .gz is as old as it's easy to get.[/color]

                  Can we assume that the 0.9.1 version Guido posted to alt.sources does build?

                  Google Groups for "Python 0.9.1 group:alt.sourc es".

                  Reinhold

                  Comment

                  • Michael Hudson

                    #10
                    Re: Syntax error after upgrading to Python 2.4

                    Reinhold Birkenfeld <reinhold-birkenfeld-nospam@wolke7.n et> writes:
                    [color=blue]
                    > Michael Hudson wrote:[color=green]
                    >> jepler@unpython ic.net writes:
                    >>[color=darkred]
                    >>> On Sat, Aug 06, 2005 at 05:15:22PM -0400, Terry Reedy wrote:
                    >>>> In any case letting developers add new features is part of the price of
                    >>>> getting unpaid bug fixes for free software. But note that PSF does not
                    >>>> make you to upgrade. Here is the current list of possible downloads.
                    >>>>
                    >>> [a mere 8 versions]
                    >>>
                    >>> Oh, don't give such a short list! Here's what I found on the python.org ftp site:[/color]
                    >>
                    >> [...]
                    >>[color=darkred]
                    >>> And then there's CVS...[/color]
                    >>
                    >> Which doesn't build for the really early versions. I think
                    >> python1.0.1.tar .gz is as old as it's easy to get.[/color]
                    >
                    > Can we assume that the 0.9.1 version Guido posted to alt.sources does build?[/color]

                    Dunno!
                    [color=blue]
                    > Google Groups for "Python 0.9.1 group:alt.sourc es".[/color]

                    Oh good grief, "Python 0.9.1 part 01/21", I'm much to lazy to sort all
                    that out today... still, would be nice if someone did; in

                    ftp:anonymous@p ython.org:/pub/python/src/README

                    we find:

                    Older sources
                    =============

                    If you find an older Python release (e.g. 0.9.8), we're interested
                    in getting a copy! webmaster@pytho n.org

                    Cheers,
                    mwh

                    --
                    <teratorn> I must be missing something. It is not possible to be
                    this stupid.
                    <Yhg1s> you don't meet a lot of actual people, do you?

                    Comment

                    • nicolas_riesch

                      #11
                      Re: Syntax error after upgrading to Python 2.4


                      frr@easyjob.net wrote:[color=blue]
                      > additive = self.additive,
                      > ^
                      > SyntaxError: invalid syntax
                      >[/color]
                      I'm using Windows XP and Python 2.4.1[color=blue]
                      >
                      > Any ideas? O:-)[/color]

                      I had a similar problem with python 2.4.1.

                      When I imported some module, I got a SyntaxError like you.

                      But if I run the module directly, and not importing it, it works and
                      dos not trigger any SyntaxError.

                      As a workaround, I put a comment ( just a # can do ) at the end of the
                      offending line, and I could then import the module without any problem.

                      It is certainly a bug, and I think it is perhaps this one ( bug 1211639
                      ):


                      or this one ( bug 1200686 ):


                      Comment

                      • Walter Dörwald

                        #12
                        Re: Syntax error after upgrading to Python 2.4

                        frr@easyjob.net wrote:
                        [color=blue]
                        > Hi,
                        >
                        > After upgrading to 2.4 (from 2.3), I'm getting a weird syntax error:
                        >
                        >[color=green][color=darkred]
                        >>>>import themes[/color][/color]
                        >
                        > Traceback (most recent call last):
                        > File "<interacti ve input>", line 1, in ?
                        > File "themes.py" , line 564
                        > font = self.font.makeB lackAndWhite(),
                        > additive = self.additive,
                        > ^
                        > SyntaxError: invalid syntax
                        >
                        > The relevant code is:
                        >
                        > def makeBlackAndWhi te( self ):
                        >
                        > return CharStyle( names = self.names,
                        > basedOn = self.basedOn.ma keBlackAndWhite (),
                        > font = self.font.makeB lackAndWhite(),
                        > additive = self.additive,
                        > prefixText = self.prefixText )
                        >
                        > This is a method in the CharStyle class which returns a new modified
                        > instance of CharStyle.
                        >
                        > I'm using Windows XP and Python 2.4.1
                        >
                        > Any ideas? O:-)[/color]

                        This is probably related to http://www.python.org/sf/1163244. Do you
                        have a PEP 263 encoding declaration in your file? Can you try
                        Lib/codecs.py from current CVS?

                        Bye,
                        Walter Dörwald

                        Comment

                        Working...