Hello All, I've a configuration.ini file. This particular can be accessed by several threads of my application. Each thread can read/write configuration parameters from/to the configuration.ini file. I am using threading (Rlock) to lock the resource (configuration.ini file) while accessing it from any thread. I use the file available at http://www.voidspace.org.uk/python/configobj.html for read/write. (configobj.py)
I've used RLock to lock the resource. I see this error while accessing variables of the configuration.ini file Exception in thread Thread-3: Traceback (most recent call last): File "C:\Python25\lib\threading.py", line 460, in __bootstrap self.run() File "F:\abc.py", line 229, in run option1 = conf['OPT1'] File "F:\configobj.py", line 551, in __getitem__ val = dict.__getitem__(self, key) KeyError: 'OPT1' Exception in thread Thread-1: Traceback (most recent call last): File "C:\Python25\lib\threading.py", line 460, in __bootstrap self.run() File "F:\def.py", line 130, in run option2 = self.conf['OPT2'] File "F:\configobj.py", line 551, in __getitem__ val = dict.__getitem__(self, key) KeyError: 'OPT2' Can any one help me with a code for locking a resource across threads. One more observation. I tried the following code on Python Idle >>> import threading >>> threading.RLock() <_RLock(None, 0)> >>> threading.Lock() <thread.lock object at 0x019350B0> Why does threading.RLock() return None Thanks In Advance, Tarun
-- http://mail.python.org/mailman/listinfo/python-list