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 <da...@ieee.org> wrote: > Shurui Liu (Aaron Liu) wrote: >> >> # geek_translator3.py >> >> # 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. >> >> <snip, rest of source> >> >> 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' >> >> I don't understand, I don't write anything about pickle.py, why it >> mentioned? >> what's wrong with "import pickle"? I read many examples online whose >> has "import pickle", they all run very well. >> Thank you! >> >> > > I don't have 2.5 any more, so I can't look at the same file you presumably > have. And line numbers will most likely be different in 2.6. In > particular, there are lots of module comments at the beginning of my version > of pickle.py. You should take a look at yours, and see what's in line 13. > My guess it's a reference to the dump() function which may be defined in the > same file. Perhaps in 2.5 it was defined elsewhere. > > Most common cause for something like this would be that pickle imports some > 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? > > DaveA > > -- Shurui Liu (Aaron Liu) Computer Science & Engineering Technology University of Toledo 419-508-1228 _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor