473,545 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Aug 5 '05 #1
11 2523

<fr*@easyjob.ne t> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
After upgrading to 2.4 (from 2.3), I'm getting a weird syntax error:
import themes
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 location of the caret is sometimes misleading, especially with
proportional fonts...
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:-)


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.ne t> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.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.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-----

Aug 6 '05 #7
je****@unpython ic.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****@unpython ic.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.sourc es".

Reinhold
Aug 9 '05 #9
Reinhold Birkenfeld <re************ ************@wo lke7.net> writes:
Michael Hudson wrote:
je****@unpython ic.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.sourc es".


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*******@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! we*******@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?
Aug 10 '05 #10

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

Similar topics

6
1628
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 2.4 or postpone it. This is my first `major version change`, so I've come up against the usual windoze (tm) problem - upgrading python breaks all my extension modules. I've been looking into the...
7
4371
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 situation: try... (Python 2.4 (#60, ...)) >>> i = 1 >>> i
0
1845
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.4.1 under Windows. When I import files with the above coding header I get frequent syntax errors with files that work flawlessly under Linux. The Syntax error usually appear near continuation...
2
2463
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 code which does this... MyScript.py ------------------ import wmi # the ip of my own local desktop
4
1951
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 actually no syntax error at all !! I'm using python 2.4.3 on windows, with gvim.. I realize this might because of the tab and space, so I use listchars in vim to all my tabs and trailing spaces...
8
3672
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 built in function sum, but still do not see the problem. The code was cut and paste. Please help. Thanks. _________________________BEGIN_CODE_________________________ #!/usr/bin/python ps =
7
1659
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 newsgroup, so hopefully you can avoid flaming me if I have :) I apologize for the length of this post but I figure the more information the better. My problem is that I'm getting a syntax error...
2
1578
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 syntax any idea what is incorrect in my syntax
0
1834
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 of creating a SyntaxError I still can't access variable defined before the error. -- Boutillier Alexis Methodology engineer
0
7499
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7943
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6022
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3490
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.