En Wed, 25 Jul 2007 17:32:46 -0300, Conrado PLG <[EMAIL PROTECTED]>
escribió:
> Say you have this structure:
>
> pna/
> __init__.py
> model.py
>
>
> __init__.py is empty.
>
> model.py is:
>
>
> import cPickle as pickle
>
> class A(object):
> pass
>
> def serialize():
> pickle.dump(A(), open('temp.dat', 'wb'))
>
>
> Now open a python interpreter on the root directory of that structure
> and type:
>
>
> import pna.model
> pna.model.serialize()
>
>
> The following exception is thrown:
>
>
> Traceback (most recent call last):
> File "test.py", line 2, in <module>
> pna.model.serialize()
> File "...\pna\model.py", line 7, in serialize
> pickle.dump(A(), open('temp.dat', 'wb'))
> cPickle.PicklingError: Can't pickle <class 'pna.model.A'>: import of
> module pna.model failed
It works for me. What are those "..." in the file name?
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list