[IronPython] pickling python types

Idan Zaltzberg idan at cloudshare.com
Mon Mar 22 08:13:12 CET 2010


Hi,

I tried running the following code and got an exception (Ipy 2.6 final):



import clr

from System import Int64

pickle.dumps(clr.GetPythonType(Int64))



*throws:*

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "C:\systems\3rd_party\IronPython\2.6\Lib\pickle.py", line 1366, in
dumps

  File "C:\systems\3rd_party\IronPython\2.6\Lib\pickle.py", line 224, in
dump

  File "C:\systems\3rd_party\IronPython\2.6\Lib\pickle.py", line 286, in
save

  File "C:\systems\3rd_party\IronPython\2.6\Lib\pickle.py", line 746, in
save_global

pickle.PicklingError: Can't pickle <type 'Int64'>: it's not found as System
in mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089.Int64



Is this a bug?

Currently my workaround is to pickle the CS type and convert it to a python
type after unpickling, please tell me if there is a better way.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100322/51bdb0c8/attachment.html>


More information about the Ironpython-users mailing list