unhashable type when using pickle.load()
Martin Franklin
mfranklin1 at gatwick.westerngeco.slb.com
Mon Jun 17 08:47:39 EDT 2002
On Monday 17 Jun 2002 10:03 am, you wrote:
> 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
Mark,
Could you be falling foul of a file close() problem IOW are you closing the
file explicitly? This could be a GC thing (discussed recently) where java
rather than python's GC is not closing the file when it goes out of scope....
Could be way off but worth saying.
Cheers,
Martin
More information about the Python-list
mailing list