[Ironpython-users] IronPython, Daily Digest 3/26/2013

CodePlex no_reply at codeplex.com
Wed Mar 27 08:19:13 CET 2013


Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:ISSUES

1. [New issue] ScriptScope.TryGetVariable<>() throws exception if item isn't string.

----------------------------------------------

ISSUES

1. [New issue] ScriptScope.TryGetVariable<>() throws exception if item isn't string.
http://ironpython.codeplex.com/workitem/33918
User Thaumaturge has proposed the issue:

"This is a snipit of my test C# code...
         source = "NewThing = 1.234";
         pySource = pyEngine.CreateScriptSourceFromString(source, SourceCodeKind.AutoDetect);
         pySource.Execute(pyScope);
         string strTemp;
         if(pyScope.TryGetVariable<string>("NewThing", out strTemp))
         {
   
         }

This is the exception I'm getting.

IronPython.Runtime.Exceptions.TypeErrorException was unhandled
  HResult=-2146233088
  Message=expected str, got float
  Source=Anonymously Hosted DynamicMethods Assembly
  StackTrace:
       at CallSite.Target(Closure , CallSite , Object )
       at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
       at CallSite.Target(Closure , CallSite , Object )
       at Microsoft.Scripting.Runtime.DynamicOperations.ConvertTo[T](Object obj)
       at Microsoft.Scripting.Hosting.ObjectOperations.ConvertTo[T](Object obj)
       at Microsoft.Scripting.Hosting.ScriptScope.TryGetVariable[T](String name, T& value)
       at TypeConverterExample.Form1.button1_Click(Object sender, EventArgs e) in c:\Source\Workshop\Brenth\TypeConverterExample\TypeConverterExample\Form1.cs:line 83
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at TypeConverterExample.Program.Main() in c:\Source\Workshop\Brenth\TypeConverterExample\TypeConverterExample\Program.cs:line 19
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Is there a better way to do this, or wouldn't it be better to return false than throw an exception?"
----------------------------------------------



----------------------------------------------
You are receiving this email because you subscribed to notifications on CodePlex.

To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20130327/aba1ec55/attachment.html>


More information about the Ironpython-users mailing list