try... except SyntaxError: unexpected EOF while parsing

Steve Holden steve at
Wed Apr 4 20:46:15 CEST 2007

Steve Holden wrote:
> oscartheduck wrote:
> Yes. SyntaxError is raised when the interpreter is compiling the Python 
> into byetcodes ready for execution. This *can* happen at run time, but 
> usually it's when you are importing a module and so it gets 
> transmogrified into an ImportError, though you can trigger it with, for 
> example, eval:
Of course I omitted to notice that input() can also raise SyntaxError 
... sorry about that.

Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd
Skype: holdenweb
Recent Ramblings

More information about the Python-list mailing list