The name error exception does give you the name causing the grief, but the line number isn't available, not without doing a little extra work (as Dino outlined) by wrapping up the evaluation of the snippet within a python try... except block and pulling some of the info in from sys.exc_info() and exposing it to the application hosting the PythonEngine.
The name isn't really enough for us, we need access to the line number and a python stack trace so clients can better analyse what went wrong (we aren't evaluating one line exceptions, these are like 100 line snippets)... and there are some other errors where the information provided in the exception makes it very difficult to resolve the issue without access to the additional info. Chez, - Alex > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:users- > [EMAIL PROTECTED] On Behalf Of J. Merrill > Sent: Wednesday, 17 May 2006 3:50 a.m. > To: Discussion of IronPython > Subject: Re: [IronPython] Line numbers in snippets... > > Shouldn't all Python errors (not just Synax) provide the filename & line > number? Column number would often be less important, particularly for > run-time (vs compile-time -- e.g. not Syntax) errors. > > As a practical matter, how can it be that a PythonNameError exception > doesn't provide a way to get at the name that couldn't be resolved? What > more important bit of info could there be? (But I haven't looked to make > sure that the name is NOT available in the latest IP.) > > At 04:55 PM 5/15/2006, Dino Viehland wrote > >Ahh, ok... Can you wrap the user code you run w/ more python code? If > you could then you could do: > >[snip] > > > J. Merrill / Analytical Software Corp > > > _______________________________________________ > users mailing list > users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com