Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using API for developing the extension and the API uses

System.Runtime.Serialization.Formatters.Binary.BinaryFormatter

to Serialize the pathon data types it works good until I am using builtin data types of python for storing data in variables for future use

but my problem is when I inherit one of the data types and try to restart the application it has problems while serializing and does not store the object

and I would like to know that is there any method I can make my objects Serializable without converting them to standard data types

for reference maybe following code helps

Code

from System import MarshalByRefObject  as MBRO
from System.Runtime.Serialization.Formatters.Binary import BinaryFormatter  as BF
from System.IO import File
class SampleObject(MBRO):
    def __init__(self):
        self.a = 2
        self.b = 3
        self.c =4
        self.d = 5

s=SampleObject()
st=File.Create(r"D:\users\*******\****\***********\test4")

bfo=BF()
bfo.Serialize(st,s)
st.Close()

Error

SystemError: Type 'IronPython.NewTypes.System.MarshalByRefObject_4$4' in Assembly 'Snippets.scripting, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.