[IronPython] Importing standard Python libs

Lukáš Duběda loocas at duber.cz
Sat Feb 20 22:47:25 CET 2010


Hmm, but this is strange.

The Interop works, but IronPython throws a lot of exceptions
at me when executing, or rather, passing a string to execute
as a function, for example, in the remote application.

Here's the exception:

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80040201): An event was 
unable to invoke any of the subscribers (Exception from HRESULT: 0x80040201)
    at 
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 
errorCode, IntPtr errorInfo)
    at 
Microsoft.Scripting.ComInterop.ComRuntimeHelpers.CheckThrowException(Int32 
hresult, ExcepInfo& excepInfo, UInt32 argErr, String message)
    at CallSite.Target(Closure , CallSite , Object , String )
    at 
System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite 
site, T0 arg0, T1 arg1)
    at CallSite.Target(Closure , CallSite , Object , String )
    at CallSite.Target(Closure , CallSite , CodeContext , Object , String )
    at 
System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite 
site, T0 arg0, T1 arg1, T2 arg2)
    at onBtnPressed$101(Closure , PythonFunction , Object , Object , 
Object )
    at 
IronPython.Compiler.PythonCallTargets.OriginalCallTarget3(PythonFunction 
function, Object arg0, Object arg1, Object arg2)
    at IronPython.Runtime.PythonFunction.FunctionCaller`3.Call3(CallSite 
site, CodeContext context, Object func, T0 arg0, T1 arg1, T2 arg2)
    at CallSite.Target(Closure , CallSite , Object , Object , EventArgs )
    at 
System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite 
site, T0 arg0, T1 arg1, T2 arg2)
    at _Scripting_(Object[] , Object , EventArgs )
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 
msg, IntPtr wparam, IntPtr lparam)
***********************************************

the code that I execute is simple, it looks like this:

maxApp = 
Activator.CreateInstance(Type.GetTypeFromProgID('MAX.Application.2009'))

then:

maxApp.runMXS(r'colorMan.getColor #background')

this is a call to a function of the remote app (colorMan) and
its method for getting the app's color.

The weirdest thing is, some functions, even though they
throw an error, still get executed after I hit "Continue".

Do you have any idea what might be causing this?

Thanks a lot in advance, cheers,

Lukáš Duběda
Director
[T] +420 602 444 164

duber studio(tm)
[M] info at duber.cz
[W] http://www.duber.cz

[A] R.A.Dvorského 601, Praha 10
[A] 10900, Czech Republic, Europe

Lukas Cenovsky wrote:
> Lukáš Duběda wrote:
>> Hi Lukas,
>>
>> thanks for the tip, it actually never occured to me.
>> I'm used to using the win32com module for communicating
>> with an OLE server I established in a separate application.
>>
>> I'm tryint to send code in different language, native
>> to the app., via this OLE bridge and for that I used
>> to use win32com.client module and then I registered
>> the app and its exposed methods.
>>
>> But now when I come to think of it, it might be a much
>> better idea doing it via .NET. However, I have
>> no idea where to start. :)
> 
> Check this page:
> http://www.ironpython.info/index.php/Contents#Interop
> 
> -- 
> -- Lukáš
> 
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list