How to retrieve code line number and column number in python script code for sciptrun execution exception?

It would even be nice to retrieve “responsible code text”; As several instructions can be in one line separated by “;”
Now I get smth like this:
Attempted to divide by zero. at Microsoft.Scripting.Utils.MathUtils.FloorDivideUnchecked(Int32 x, Int32 y)
at IronPython.Runtime.Operations.Int32Ops.FloorDivide(Int32 x, Int32 y)
at IronPython.Runtime.Binding.PythonBinaryOperationBinder.IntDivide(CallSite site, Object self, Object other)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at IronPython.Compiler.PythonScriptCode.Run(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)
at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
at Microsoft.Scripting.Hosting.ScriptEngine.Execute(String expression, ScriptScope scope)
at Alternet.Scripter.IronPython.InMemoryRunnableScript.Execute(ScriptEngine engine, ScriptScope scope)
at Alternet.Scripter.IronPython.IronPythonScriptHost.ExecuteAllScripts()
at Alternet.Scripter.IronPython.IronPythonScriptHost.RunCore()
at Alternet.Scripter.IronPython.ScriptHost.InternalRun()
at Alternet.Scripter.IronPython.ScriptHost.Run()
at Alternet.Scripter.IronPython.ScriptRun.Run()
at PythonAndCSharpScripting.ViewModelBase.RunUserScript() in …

Hi audrius,

Could you please try to call Engine.GetService to get more details about exception in the exception catch block like this:

            try
            {
                scriptRun.RunFunction("OnPaint", new object[] { e.Graphics, displayPanel.ClientRectangle, currentAngle });
            }
            catch (Exception ex)
            {
                var trace = ((Alternet.Scripter.IronPython.IronPythonScriptHost)scriptRun.ScriptHost).Engine.GetService<Microsoft.Scripting.Hosting.ExceptionOperations>().FormatException(ex);

                MessageBox.Show(this, ex.Message, "Script Execution Error");
                StopScript();
            }

Where trace will contain information in such form:
Traceback (most recent call last):
File “”, line 1, in
File “”, line 10, in OnPaint
ZeroDivisionError: Attempted to divide by zero.

Regards,
Andrew