Establishing why an object can't be pickled

前端 未结 4 2064
小蘑菇
小蘑菇 2021-01-11 14:37

I\'m receiving an object, t, from an api of type Object. I am unable to pickle it, getting the error:

  File \"p.py\", line 55, in          


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-11 15:05

    You may want to read the python docs and check your API's Object class afterwards.

    With respect to the "internal structure of the object", usually instance attributes are stored in the __dict__ attribute (and since class attributes are not pickled you only care about the instance attributes) - but note that you'll also have to recursively inspect the __dict__s for each attribute.

提交回复
热议问题