By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,814 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,814 IT Pros & Developers. It's quick & easy.

always raise syntax error!

P: n/a
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 visible, make sure they are
used consistently, but python still raise syntax error, no further
description, and just make no sense to me.

anyone heard of such issue or the like before?
many thanks....

daniel

Oct 13 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Thu, 12 Oct 2006 23:25:58 -0700, daniel wrote:
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 !!
Looking into my crystal ball, I see that you are correct, there is no
syntax error -- because there is no code! There might not even be a
computer. It is all an illusion brought on by lack of fresh air.

Or maybe not -- my crystal ball is notoriously unreliable.

How about you post the FULL traceback of the error, so we can see for
ourselves if there is a syntax error or not?

e.g.
>>x{4} = 5
File "<stdin>", line 1
x{4} = 5
^
SyntaxError: invalid syntax

--
Steven

Oct 13 '06 #2

P: n/a
thank you so much for the reply.

I finally re-type all the codes where python would raise syntax error,
then fixed. I did not examine every single word of my old codes though,
there might be some parenthesis not matching somewhere, I guess.

well, I would say, the reason why I could not position the error code
may partly due to the ambiguous message that python provides. the lines
that python pointed to contains no error, I think the error codes must
be too far away from there. anyway, I hope python would make more
detailed error messages, like c++ compilers do. such as: "missing ;" or
"(" not matching...etc.

tks again..

daniel

Oct 13 '06 #3

P: n/a
daniel wrote:
thank you so much for the reply.

I finally re-type all the codes where python would raise syntax error,
then fixed. I did not examine every single word of my old codes though,
there might be some parenthesis not matching somewhere, I guess.

well, I would say, the reason why I could not position the error code
may partly due to the ambiguous message that python provides. the lines
that python pointed to contains no error, I think the error codes must
be too far away from there. anyway, I hope python would make more
detailed error messages, like c++ compilers do. such as: "missing ;" or
"(" not matching...etc.

tks again..

daniel
What Steve is trying to tell you is that you need to copy/paste your
code (with the full traceback) in future messages. We are not mind
readers out here.

Occassionally I will have phantom syntax errors that seem to be
attributable to non-printing characters in a line. Other times the
error is in fact far above the place pointed to by the syntax error.
Start by commenting out large chunks of code with triple quotes and
slowly work towards the lines with a problem.

-Larry Bates
Oct 13 '06 #4

P: n/a
In article <rO******************************@comcast.com>,
Larry Bates <la*********@websafe.comwrote:
>daniel wrote:
Oct 16 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.