[IronPython] Embedded IronPython in .NET C# WinForm app error

Mitch Barnett mbarnett at uniserve.com
Fri Jul 11 18:35:06 CEST 2008


I was able to repro this error using the ParseInteractiveInput code sample
from the IPy 1.1.1 help file and pasting this directly into a VS 2008 C#
console project.

The tutorial exercise that causes the error is Merlin the Wizard.

Using the EngineOptions I was able to get more detail on the error:

>>>a = AgentServerClass()
Creating an instance of the COM component with CLSID
{D45FD2FC-5C6E-11D1-9EC1-00
C04FD7081F} from the IClassFactory failed due to the following error:
80004002.
   at .ctor##21()
   at IronPython.Runtime.Calls.FastCallable0.Call(ICallerContext context)
   at IronPython.Runtime.Calls.FastCallable0.Call(ICallerContext context,
Object
[] args)
   at IronPython.Runtime.Calls.BuiltinFunction.Call(ICallerContext context,
Obje
ct[] args)
   at IronPython.Runtime.Types.DynamicType.AllocateObject(Object[] args)
   at IronPython.Runtime.Operations.InstanceOps.DefaultNew(ICallerContext
contex
t, DynamicType typeô, Object[] argsá)
   at DefaultNew##17(ICallerContext , Object )
   at
IronPython.Runtime.Calls.FastCallableWithContextAny.Call(ICallerContext co
ntext, Object arg0)
   at
IronPython.Runtime.Calls.FastCallableWithContextAny.Call(ICallerContext co
ntext, Object[] args)
   at IronPython.Runtime.Calls.BuiltinFunction.Call(ICallerContext context,
Obje
ct[] args)
   at IronPython.Runtime.Operations.Ops.CallWithContext(ICallerContext
context,
Object func, Object[] args)
   at IronPython.Runtime.Types.DynamicType.CreateInstance(ICallerContext
context
, Object[] args, String[] names)
   at IronPython.Runtime.Types.DynamicType.Call(ICallerContext context,
Object[]
 args, String[] names)
   at IronPython.Runtime.Types.DynamicType.Call(ICallerContext context,
Object[]
 args)
   at IronPython.Runtime.Operations.Ops.CallWithContext(ICallerContext
context,
Object func, Object[] args)
   at IronPython.Runtime.Operations.Ops.CallWithContext(ICallerContext
context,
Object func)
   at <stdin>##16(ModuleScope )
   at IronPython.Hosting.CompiledCode.Run(ModuleScope moduleScope)
   at IronPython.Hosting.PythonEngine.ExecuteToConsole(String text,
EngineModule
 engineModule, IDictionary`2 locals)
   at IronPython.Hosting.PythonEngine.ExecuteToConsole(String text)
   at IPConsole.SimpleConsole.Run() in
C:\Users\Mitch.Barnett\Documents\Visual S
tudio 2008\Projects\IPConsole\IPConsole\Program.cs:line 35
TypeError: Creating an instance of the COM component with CLSID
{D45FD2FC-5C6E-1
1D1-9EC1-00C04FD7081F} from the IClassFactory failed due to the following
error:
 80004002.
CLR Exception:
    InvalidCastException
:
Creating an instance of the COM component with CLSID
{D45FD2FC-5C6E-11D1-9EC1-00
C04FD7081F} from the IClassFactory failed due to the following error:
80004002.
>>>

Any help appreciated!

Mitch


-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Mitch Barnett
Sent: Tuesday, July 08, 2008 4:57 AM
To: users at lists.ironpython.com
Subject: [IronPython] Embedded IronPython in .NET C# WinForm app error

Hello,

I have a .NET C# WinForm application that hosts an IronPython 1.1 engine.
In the WinForm app, the scripting API is exposed through a web service
interface (using Windows Communication Foundation) so that from a remote
console, (over WCF), I can execute IronPython code on the computer that is
running the WinForm app.

The project is at: http://www.codeplex.com/gsb

Works 99% of the time, but the 1% of the time that it does not work is for
cases like this:

>>> IronPython 1.1 (1.1) on .NET 2.0.50727.1433 
>>> import clr
>>> import sys
>>> sys.path.append(r"c:\projects\gsbservice\gsbservice1")
>>> clr.AddReferenceToFile("AgentServerObjects.dll")
>>> from AgentServerObjects import *
>>> a = AgentServerClass()
Traceback (most recent call last): File C:\Projects\GSBService\GSBService1
\ParseInteractive.cs, line 93, in CallIPCmd File , line 0, in <stdin>##21 
File , line 0, in DefaultNew##22 File , line 0, in .ctor##26 TypeError: 
Creating an instance of the COM component with CLSID
{D45FD2FC-5C6E-11D1-9EC1-
00C04FD7081F} from the IClassFactory failed due to the following error: 
80004002. 
>>>

Of course if I try the same thing using the IPY.exe console on the same
computer, using the same AgentServerObjects.dll, it works just fine.

Any thoughts appreciated as to what might be going wrong.

Thanks,

Mitch

_______________________________________________
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