PythonScript errormessages in 2.4
Hi, Is it just me or are the errormessages from parse and syntax errors in PythonScripts from Zope 2.4 next to useless?
Script line 1 REQUEST = context.REQUEST ^ SyntaxError: invalid syntax
This isn't where the error is, reminds me of the helpful parse errors from DTML... Any ideas? cheers, Chris
[Chris Withers] | Any ideas? I've seen similar stuff from the python interpreter. Could I see the complete script?
Erik Enge wrote:
[Chris Withers]
| Any ideas?
I've seen similar stuff from the python interpreter. Could I see the complete script?
It was an indentation error, but I think somethign is broken here, 'cos I get the same with missed brackets, etc... cheers, Chris
Chris Withers wrote:
Hi,
Is it just me or are the errormessages from parse and syntax errors in PythonScripts from Zope 2.4 next to useless?
For a certain definition of useless, yes.
Script line 1 REQUEST = context.REQUEST ^ SyntaxError: invalid syntax
This isn't where the error is,
But it's where python *thinks* the error is. For a certain class of syntax errors, python cannot tell you exactly where the error is. I have no reason to give you why this is, but Python is not the only language effected by this, C programmers are often confronted by compiler errors reported on the next or previous line from the actual error. I wouldn't doubt it if other langauges have this problem for certain classes of errors also. That's just life. What's odd is that you said it's an indentation error. When I try this script with python 2.1: print 'hi' for i in range(10): print 'foo' I don't get a SyntaxError, I get an IndentationError: Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/tmp/python-2029Osa", line 4 print 'foo' ^ IndentationError: expected an indented block Notice that it also points to a weird place. -Michel
Michel Pelletier wrote:
I don't get a SyntaxError, I get an IndentationError:
Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/tmp/python-2029Osa", line 4 print 'foo' ^ IndentationError: expected an indented block
Notice that it also points to a weird place.
Assuming a 4 character indentation, the caret is pointing to where the indentation would be expected to start. Chance or design? I don't know. -- Steve Alexander Software Engineer Cat-Box limited
Michel Pelletier wrote:
What's odd is that you said it's an indentation error. When I try this script with python 2.1:
print 'hi' for i in range(10): print 'foo'
..what I had was the equivalent of : print 'hi' for i in range(10): print 'foo' ...and I didnt' get an IndentationError... cheers, Chris
participants (4)
-
Chris Withers -
Erik Enge -
Michel Pelletier -
Steve Alexander