Re: always raise syntax error!

2006-10-16 Thread Cameron Laird
In article [EMAIL PROTECTED],
Larry Bates  [EMAIL PROTECTED] wrote:
daniel wrote:
.
.
.
 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.
.
.
.
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

I'll reinforce part of this:  if C++ compilers are our standard, 
Python needn't feel shame about its error-reporting.  While I've
long advocated upgrades to Python's diagnostic-reporting, it's
simply not true that Python points to no error.  Python reports
a syntax error on a particular line only when there's sufficient
reason.  

I recognize a background with C++ will probably necessitate 
accomodation to Python, because the two do NOT employ the same
style for syntax questions.  Please, though, daniel:  don't make
the mistake of thinking Python's syntax is a mystery.
-- 
http://mail.python.org/mailman/listinfo/python-list


always raise syntax error!

2006-10-13 Thread daniel
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

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: always raise syntax error!

2006-10-13 Thread Steven D'Aprano
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 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: always raise syntax error!

2006-10-13 Thread daniel
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

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: always raise syntax error!

2006-10-13 Thread Larry Bates
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
-- 
http://mail.python.org/mailman/listinfo/python-list