unhashable type when using pickle.load()

Mark Robinson Blobbybirdman at hotmail.com
Mon Jun 17 06:03:33 EDT 2002


I wonder if anyone can shed some light on a troublesome intermittent
problem I am having.

Firstly the necessary:
I am running on windows XP, using jython 2.1 and java 1.3.1_03.

A pickled file is created as follows:
    pickle.dump((self.seq.getMotifs(), self.s[self.seqIdx]),
                    newFile)

self.seq.getMotifs() simply returns a dictionary containing various complex
python objects (which will have been created and used sucessfully)

self.s[self.seqIdx] is a python sequence object.


Intermittently, when I try and reload from this pickle file I get the
following exception:


Exception occurred during event dispatching:
Traceback (innermost last):
  File "pars.py", line 129, in OpenFile
  File "D:\program files\jython-2.1\Lib\pickle.py", line 947, in load
  File "D:\program files\jython-2.1\Lib\pickle.py", line 567, in load
  File "D:\program files\jython-2.1\Lib\pickle.py", line 885, in
load_setitem
TypeError: unhashable type

I have read that this error typically can occur when a pyDictionary or
pyList is inserted into a hashtable. Is this a problem that anyone else is
familiar with, is it a limitation of the jython implementation of pickle?

Any help will be appreciated

Blobby







More information about the Python-list mailing list