[Python.NET] AttributeError: 'MarshalByRefObject' object has no attribute ...

Martin Richard Richard.Martin at thomson.net
Tue Dec 28 21:57:06 CET 2004


This is python 2.3.

I start a toy .NET service.  This is a C-sharp executable.

In the C-sharp files, this code exists:

namespace foo
{
    public class Toy : MarshalByRefObject, IToy
    ...
}

In python, after loading an assembly, I can successfully do either:
  from CLR.foo import Toy
  from CLR.foo import IToy    

I can get a string for the url of the service from the config file.

I then try:
   # using Toy also gives the same result
   remoteObj = System.Activator.GetObject(IToy, url)  

and it returns this for remoteObj:
  <CLR.System.MarshalByRefObject object at 0x0090D090>

If I try to invoke a method on remoteObj, I get this error:
   AttributeError: 'MarshalByRefObject' object has no attribute
'methodName'.

It is almost as if the remoteObj has not been cast to the correct type
(Itoy).  But if I do remoteObj.ToString() it returns 'foo.Toy'.

If I just try to instantiate a local instance of Toy --
   t = Toy()
-- this succeeds, and I can successfully invoke the method that fails on
the remoteObj.

Any ideas why the remoteObj is failing?

Thanks,

Rick







More information about the PythonDotNet mailing list