Syntax error after upgrading to Python 2.4

F

frr

Hi,

After upgrading to 2.4 (from 2.3), I'm getting a weird syntax error:
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "themes.py", line 564
font = self.font.makeBlackAndWhite(),
additive = self.additive,
^
SyntaxError: invalid syntax

The relevant code is:

def makeBlackAndWhite( self ):

return CharStyle( names = self.names,
basedOn = self.basedOn.makeBlackAndWhite(),
font = self.font.makeBlackAndWhite(),
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:)
 
T

Terry Reedy

After upgrading to 2.4 (from 2.3), I'm getting a weird syntax error:

Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "themes.py", line 564
font = self.font.makeBlackAndWhite(),
additive = self.additive,
^
SyntaxError: invalid syntax

The location of the caret is sometimes misleading, especially with
proportional fonts...
The relevant code is:

def makeBlackAndWhite( self ):

return CharStyle( names = self.names,
basedOn = self.basedOn.makeBlackAndWhite(),
font = self.font.makeBlackAndWhite(),
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:)

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
 
F

Fernando

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?)
Yes.

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.

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. :)
 
P

Peter Hansen

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

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.
<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.

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
 
J

John Machin

Fernando said:
I reinstalled version 2.3.5

You didn't need to remove it in the first place.
and everything works fine now. It's
definately something related to the latest version.

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

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

Well stick with Python 2.3.5 then!!
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>

Or switch to (e.g.) Sather; no funsters adding bugs & misfeatures to
that sucker :)
Feeling much better now. :)

I hope so ...
 
T

Terry Reedy

I wrote

Did you try either of these.
I reinstalled version 2.3.5 and everything works fine now. It's
definately something related to the latest version.

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.
<rant> ....
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>

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)
Feeling much better now. :)

I'm not.

Terry J. Reedy
 
J

jepler

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:

# 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.gz

And then there's CVS...

Jeff

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

iD8DBQFC9Us8Jd01MZaTXX0RAnZBAJ9QjHP3GFcy7gEZhn55xYuV2HjipACfZbVd
HD7W5JPMzhMVtadShx50Q7M=
=NLSq
-----END PGP SIGNATURE-----
 
M

Michael Hudson

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:
[...]

And then there's CVS...

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
 
R

Reinhold Birkenfeld

Michael said:
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:
[...]

And then there's CVS...

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.

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.sources".

Reinhold
 
M

Michael Hudson

Reinhold Birkenfeld said:
Michael said:
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:
[...]

And then there's CVS...

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.

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

Google Groups for "Python 0.9.1 group:alt.sources".

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:[email protected]:/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! (e-mail address removed)

Cheers,
mwh
 
N

nicolas_riesch

additive = self.additive,
^
SyntaxError: invalid syntax
I'm using Windows XP and Python 2.4.1
Any ideas? O:)

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
):
http://sourceforge.net/tracker/index.php?func=detail&aid=1211639&group_id=5470&atid=105470

or this one ( bug 1200686 ):
http://sourceforge.net/tracker/index.php?func=detail&aid=1200686&group_id=5470&atid=105470
 
?

=?ISO-8859-1?Q?Walter_D=F6rwald?=

Hi,

After upgrading to 2.4 (from 2.3), I'm getting a weird syntax error:



Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "themes.py", line 564
font = self.font.makeBlackAndWhite(),
additive = self.additive,
^
SyntaxError: invalid syntax

The relevant code is:

def makeBlackAndWhite( self ):

return CharStyle( names = self.names,
basedOn = self.basedOn.makeBlackAndWhite(),
font = self.font.makeBlackAndWhite(),
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:)

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
 

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,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top