explain this pickle issue to me...

Emile van Sebille emile at fenx.com
Fri Jun 28 13:46:56 CEST 2002


Emile van Sebille
> If you add to the top of testme:
>
> __name__ = 'testme'
> import testme
>
> and change your assert to:
>
> assert isinstance(s, testme.Simple), "Not an instance of Simple"
>
> that should fake it out.  The first makes the creation of pickles use
> testme as the module name, and the second and third allows the
> isinstance to work.
>

No, it's not that hard... ;-)

You don't need to make any changes to testme.py (except fix the assert
typos) if you initialize d properly:

d = (__import__('testme').__dict__)
execfile("testme.py", d)
q = d["writeSimple"]()
d["readSimple"](q)

 Proving-again-that-sombody-always-knows-a-better-way ly y'rs,

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list