M
Michael P. Soulier
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. If anyone can shed light on this, I'd appreciate it.
Thanks,
Mike
class RemDBEntry(object):
"""This class represents one entry in the database. It stores a
merging of all of the document types supplied by the server."""
def __init__(self, timestamp):
self.timestamp = timestamp
self.procs = []
self.partitions = []
self.free = None
self.uptime = None
def merge(self, doc):
"""This method takes a RemDoc object and merges it with the
current object."""
if doc.type == 'uptime':
self.uptime = doc.scalar
elif doc.type == 'ps':
self.procs = doc.children
elif doc.type == 'siloShow':
self.partitions = doc.children
elif doc.type == 'siloShowMaxFree':
self.free = doc.scalar
else:
raise AssertionError, "Unknown document type: %s" % doc.type
--
Michael P. Soulier <[email protected]>
http://www.digitaltorque.ca
http://opag.ca python -c 'import this'
Jabber: (e-mail address removed)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQFCuMwfKGqCc1vIvggRAm/lAKCwIs4ARhlHHMIrIqLxuWSEW4bYCQCgmfTt
rJuF+R+8ZFYBMeGwDzzXx8o=
=21xf
-----END PGP SIGNATURE-----
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. If anyone can shed light on this, I'd appreciate it.
Thanks,
Mike
class RemDBEntry(object):
"""This class represents one entry in the database. It stores a
merging of all of the document types supplied by the server."""
def __init__(self, timestamp):
self.timestamp = timestamp
self.procs = []
self.partitions = []
self.free = None
self.uptime = None
def merge(self, doc):
"""This method takes a RemDoc object and merges it with the
current object."""
if doc.type == 'uptime':
self.uptime = doc.scalar
elif doc.type == 'ps':
self.procs = doc.children
elif doc.type == 'siloShow':
self.partitions = doc.children
elif doc.type == 'siloShowMaxFree':
self.free = doc.scalar
else:
raise AssertionError, "Unknown document type: %s" % doc.type
--
Michael P. Soulier <[email protected]>
http://www.digitaltorque.ca
http://opag.ca python -c 'import this'
Jabber: (e-mail address removed)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQFCuMwfKGqCc1vIvggRAm/lAKCwIs4ARhlHHMIrIqLxuWSEW4bYCQCgmfTt
rJuF+R+8ZFYBMeGwDzzXx8o=
=21xf
-----END PGP SIGNATURE-----