[Tutor] what's wrong in my command?
alan.gauld at btinternet.com
Thu Apr 1 19:18:31 CEST 2010
"Shurui Liu (Aaron Liu)" <shurui91 at gmail.com> wrote
OK, can you tell me import.py is empty or not? If it's not an empty
document, what's its content?
On Thu, Apr 1, 2010 at 5:45 AM, Dave Angel <davea at ieee.org> wrote:
>> # Pickle
>> import pickle
> This is where you told it to load import.py. Normally, that just quietly
> loads the standard module included with your system.
Dave meant to say pickle.py
There is no import.py.
>> When I run it, the system gave me the feedback below:
>> Traceback (most recent call last):
>> File "geek_translator3.py", line 4, in <module>
>> import pickle
>> File "/usr/local/lib/python2.5/pickle.py", line 13, in <module>
>> AttributeError: 'module' object has no attribute 'dump'
Did you by any chance create or edit a file called pickle.py in
the location indicated? It could be that you need to
reinstall to get the original pickle.py back.
>> I don't understand, I don't write anything about pickle.py, why it
You wrote about it when you did the import. Thats why it's mentioned.
>> what's wrong with "import pickle"? I read many examples online whose
>> has "import pickle", they all run very well.
What happens if you start a new Python interpreter session and type:
>>> import pickle
Does it work?
> Most common cause for something like this would be that pickle imports
> module, and you have a module by that name in your current directory (or
> elsewhere on the sys.path). So pickle gets an error after importing it,
> trying to use a global attribute that's not there.
> Wild guess - do you have a file called marshal.py in your own code?
And tell us about this too...
Author of the Learn to Program web site
More information about the Tutor