This may be a bit of a strange question, but is there a reliable way to serialize IronPython objects whose classes extend CLR types?
For instance:
class Foo(System.Collections.Generic.List[str]):
def Test(self):
print "test!"
System.Collections.Generic.List<string>is serialized using Pickle because it implements the interface ISerializable, but the emitted subclasses of serializable CLR types do not seem to work, and I get it ImportError: No module named Generic in mscorlib, Version=4at startup pickle.dumps(Foo()).
In addition, running the usual Formatter.Serialize(stream, object)gives me:
SystemError: Type 'IronPython.NewTypes.System.Collections.Generic.List`1_4$4' in Assembly Snippets.scripting, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
How can I serialize IronPython objects while working in a C # native environment?
source
share