Quinten (4) [Avatar] Offline
Dear Anthony Briggs,

I have a question about page 80 where you are speaking about pickle a standard library. On the command line the result of typing >>> import pickle is:
"AttributeError: 'module' object has no attribute 'dump"
>>> import textwrap
is quit right.
Why is pickle not working?(there is no typo, I think...)
anthony.briggs (30) [Avatar] Offline
Re: import pickle
Hi Quinten,

There shouldn't be any reason for that statement to fail. Here's the result of running the same thing on my computer:

Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle
>>> pickle.dump
<function dump at 0x0281D630>

dump is a function within the pickle module, so pickle.dump will give you the function object itself.

There are a couple of things that I can think of which might give you that error:
you have a file called pickle.py inside your directory which is overriding the built-in module.
there's something else that you missed with your cut and paste (just importing a module shouldn't give you that error, even if there isn't any 'dump' function within it.
there's something odd about your Python install.

It might also help to know what operating system you're running.


Quinten (4) [Avatar] Offline
Re: import pickle

Thanks for your answer. You have brought me on the right track. I use python 2.5 and 3.0. With 3.0 there is no problem. Import pickle is working there. The problem was my Python install of Python 2.5, obvious.

With regards,

P.S I use windows XP on win32