[Tutor] Unpickleable object error
Sheila King
sheila@thinkspot.net
Thu, 06 Sep 2001 13:00:22 -0700
On Thu, 6 Sep 2001 15:44:19 -0400 (EDT), Ignacio Vazquez-Abrams
<ignacio@openservices.net> wrote about Re: [Tutor] Unpickleable object
error:
:I don't think that it likes that MutexFile.MutexFile object in user. Try
:pulling it out of there and putting it somewhere else in the code.
I don't think that is the problem, because before I introduced the user
class, I was running this code without any problem (this is only a
snippet of the code, of course):
class mssgBoard:
def __init__(self, dict=None, caller=None):
self.lockfile = MutexFile.MutexFile('main.lck')
self.myfilename = 'mainboard'
if caller == 'init':
try:
self.lockfile.flock('LOCK_EX')
db = shelve.open(self.myfilename, 'n')
db['title'] = dict['title'].value
db['adminID'] = dict['adminID'].value
db['smtpserver'] = dict['smtpserver'].value
db['exitURL'] = dict['exitURL'].value
db['adminEmail'] = dict['email'].value
db['threads'] = []
db.close()
self.lockfile.flock('LOCK_UN')
except KeyError, e:
print header('Error in Message Board Init')
print body('missing keys')
Notice that it also has a MutexFile object, and it caused no problems in
shelving that object.
Code runs fine when I comment out the addUser function and the call to
it.
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/