[IronPython] Don't execute files containing errors?

Alex Turpin alex.turpin at gmail.com
Fri Feb 19 04:16:08 CET 2010


Hey all,

I am currently embedding IronPython in a C# app of mine. I need to
execute external script files, but to also be able to only executes
the ones that will be error free. Here is an example script:

a = "This is a test"
print undefinedVariable
b = "This is another test"

If I execute this script, it will halt on line 1 and thus only
executing half of it. This can be extremely confusing since declaring
the variable "a" will have worked, but not "b". I am using
PythonEngine.CreateScriptSourceFromFile.

Is there any way to check if a script contains errors before executing
it, or at the very least reverting the changes it made?

Thanks.



More information about the Ironpython-users mailing list