oddness in shelve module

John Machin sjmachin at lexicon.net
Tue Jun 21 22:42:07 EDT 2005


Michael P. Soulier wrote:
> I'm trying to add objects to a shelve db object via hash assignment, but
> I'm getting an odd exception. 
> 
> Traceback (most recent call last):
>   File "RemGui.py", line 117, in onMonitorButton
>     self.startMonitoring()
>   File "RemGui.py", line 163, in startMonitoring
>     self.monitor()
>   File "RemGui.py", line 181, in monitor
>     self.db.store_sample(dbentry)
>   File "C:\Documents and Settings\Michael Soulier\My
> Documents\projects\rem\pysr
> c\RemDBShelve.py", line 38, in store_sample
>     self.db[sample.timestamp] = sample
> TypeError: object does not support item assignment
> 
> The object itself is quite simple. 
> 
> I provide it below. 

AFAICT, wrong "it". The "item assignment" which is alleged not to be 
supported is of this form: an_object[some_key] = a_value

I.e. "self.db" is the suspect, not "sample"



More information about the Python-list mailing list