472,353 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Syntax error after upgrading to Python 2.4

frr
Hi,

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

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

Aug 5 '05 #1
11 2413

<fr*@easyjob.net> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
After upgrading to 2.4 (from 2.3), I'm getting a weird syntax error:
import themes
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

Aug 5 '05 #2
> 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. :-)

Aug 6 '05 #3
Fernando wrote:
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
Aug 6 '05 #4
Fernando wrote:
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


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 ...
Aug 6 '05 #5

"Fernando" <fr*@easyjob.net> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...

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


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


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

Aug 6 '05 #6
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:

# 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)

iD8DBQFC9Us8Jd01MZaTXX0RAnZBAJ9QjHP3GFcy7gEZhn55xY uV2HjipACfZbVd
HD7W5JPMzhMVtadShx50Q7M=
=NLSq
-----END PGP SIGNATURE-----

Aug 6 '05 #7
je****@unpythonic.net writes:
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.

Cheers,
mwh

--
Ignoring the rules in the FAQ: 1" slice in spleen and prevention
of immediate medical care.
-- Mark C. Langston, asr
Aug 8 '05 #8
Michael Hudson wrote:
je****@unpythonic.net writes:
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?

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

Reinhold
Aug 9 '05 #9
Reinhold Birkenfeld <re************************@wolke7.net> writes:
Michael Hudson wrote:
je****@unpythonic.net writes:
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:an*******@python.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! we*******@python.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?
Aug 10 '05 #10

fr*@easyjob.net wrote:
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...70&atid=105470

or this one ( bug 1200686 ):
http://sourceforge.net/tracker/index...70&atid=105470

Aug 10 '05 #11
fr*@easyjob.net wrote:
Hi,

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

import themes


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
Aug 10 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Michael Foord | last post by:
http://www.voidspace.org.uk/python/articles/upgrading_python.html I've been looking at whether to upgrade immediately from Python 2.3 to Python...
7
by: Petr Prikryl | last post by:
Hi, Summary: In my opinion, the C-like prefix increment and decrement operators (++i and --i) should be marked as "syntax error". Current...
0
by: Berthold Höllmann | last post by:
I have a default coding header # -*- coding: iso-8859-15 -*- in my python files. I now have Problems with this settings. I swithched to Python...
2
by: py | last post by:
Hi, I am running python 2.4.2 on win xp pro. I have the WMI module from Tim Golden (http://tgolden.sc.sabren.com/python/wmi.html). I have some...
4
by: daniel | last post by:
I'm not quite new to this language, but such error has never happened so frequently before. I have no idea what to do about it, because there's...
8
by: Michael Press | last post by:
I have not written python codes nor run any. I saw this code posted and decided to try it. It fails. I read the tutorial and the entry for the...
7
by: Dustin MacDonald | last post by:
Hi everyone. This is my first time posting to this newsgroup, and although I maintain my netiquette I might've missed something specific to the...
2
by: Lalit | last post by:
Hi I am executing following commands. True ------------working fine but for below statement it is giving syntax error. SyntaxError: invalid...
0
by: Alexis Boutillier | last post by:
Timothy Grant a écrit : As you can see in my last response, this problem is not linked to the type of error, If I "raise" a SystemError instead...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.