[IronPython] IronPython 2 Exception Handling from C#

Michael Foord michael.foord at resolversystems.com
Mon Mar 31 13:20:21 CEST 2008


Hello guys,

I'm being lazy. Can anyone help translate the following IronPython 1 
hosting code to the IP 2b1 API nearest equivalent. (I have already 
translated the code to execute the file - it is the exception handling 
code I need help with):

            try
            {
                engine.Sys.argv = List.Make(args);
                ScriptSource source = 
engine.CreateScriptSourceFromFile(Path.Combine(rootDir, (string)args[0]);
                source.Execute();
            }
            catch (PythonSystemExitException e)
            {
                object o;
                return e.GetExitCode(out o);
            }
            catch (Exception e)
            {
                Console.Write(engine.FormatException(e));
                return 1;
            }
            finally
            {
                PythonEngine.DumpDebugInfo();
            }
            return 0;

Thanks (in advance...)

Michael

-- 
Michael Foord
Senior Software Engineer, Resolver Systems Ltd.
michael.foord at resolversystems.com
+44 (0) 20 7253 6372

We're hiring! http://www.resolversystems.com/jobs/
17a Clerkenwell Road, London EC1M 5RD, UK
VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329.
Registered address: 843 Finchley Road, London NW11 8NA, UK




More information about the Ironpython-users mailing list