[IronPython] Stack Traces in IronPython 0.96 do not contain python stack trace

Stanislas Pinte stan at phidani.be
Wed Dec 14 10:16:48 CET 2005


hello,

Has anyone an idea of the following:

I have a script:

> #ScriptingLoopTest python code
> 
> def init_session(settings, fileNamePrefix):
>   pass
> 
> def handle_message(message):
>   passmmm

and I use IronPython 0.96 as embedded scripting engine.

private PythonEngine engine = new PythonEngine();
engine.Import(moduleName);
f = engine.Evaluate(moduleName + ".init_session") as Function;
g = engine.Evaluate(moduleName + ".handle_message") as Function;

when I do g.Call(...), IP detects that the passmm  symbol is not
defined, and throws a PythonException.

This exception only contains that:

"name 'passmmm' not defined".

It doesn't contain the line number in the imported script, nor the
trace, whereas Python 2.4 gives the following:

Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def handle_message(message):
..     passmmm
..
>>> handle_message(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 2, in handle_message
NameError: global name 'passmmm' is not defined
>>>

It is very important for me to be able to give the user that kind of
feedback...is there a way to do it?

Thanks a lot,

Stan.





More information about the Ironpython-users mailing list