Currently, when encounter a syntax error, shedskin print:
*** SHED SKIN Python-to-C++ Compiler 0.0.23 ***
Copyright 2005-2007 Mark Dufour; License GNU GPL version 3 (See LICENSE)
(Please send bug reports here: mark.dufour@gmail.com)
Traceback (most recent call last):
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 6733, in ?
main()
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 6729, in main
analysis('\n'.join([l.rstrip() for l in f]))
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 6377, in analysis
gx.main_module = module(gx.main_mod, ast)
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 200, in __init__
mv.dispatch(self.ast)
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 628, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "compiler/visitor.py", line 57, in dispatch
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 851, in visitModule
self.visit(child, None)
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 628, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "compiler/visitor.py", line 57, in dispatch
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 813, in visitStmt
self.visit(b, func)
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 628, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "compiler/visitor.py", line 57, in dispatch
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 917, in visitImport
mod = self.analyzeModule(name, pseudonym, node)
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 960, in analyzeModule
mod = module(name, None, mv.module, node)
File "/data1/src/shedskin/shedskin-0.0.23/ss.py", line 192, in __init__
self.ast = parse(file(self.filename).read())
File "compiler/transformer.py", line 52, in parse
File "compiler/transformer.py", line 129, in parsesuite
File "<string>", line 1048
has_ipv6=True
This looks more like a shedskin error than user file error. I almost gived up.
It should print:
<backtrace blah blah...>
**Syntax Error in <filename>, line <lineno>.
Logged In: YES
user_id=1305049
Originator: NO
could you give me some more context information (which syntax error, OS, version of Python..)? I just tried a few syntax errors, and I get a nice SyntaxError exception each time.
thanks!
Logged In: NO
like:
[code]
class me(object):
def __init__(self):
try:
a = 1
def main():
print a()
if __name__ == '__main__':
main()
[/code]
Logged In: NO
By the way, this is on Debian unstable with python 2.4 2.5
Logged In: YES
user_id=1305049
Originator: NO
oic, the problem is that it says <string> instead of a filename? I'll have a look.
Logged In: YES
user_id=1305049
Originator: NO
I think we can use compiler.parseFile instead of compiler.parse, and the error message should become more clear. there are some complications, as the unit test code calls ss.py:analysis with code and not a file, but nothing that can't be worked around I guess.
Logged In: NO
It can always save a filename variable.
Logged In: YES
user_id=1305049
Originator: NO
okay I made it a bit clearer in CVS. this syntax error now triggers this:
*ERROR* test.py:8: unexpected unindent
thanks!