Problem with fcntl.fcntl file locking on FreeBSD 4.x
Adam Crosby <acrosby <at> nps.k12.va.us>
2004-10-25 12:47:32 GMT
Not sure if this is a bug or a problem with my python install, but here's what happened and how I fixed it:
(First some version info)
Python:
Python 2.3.2 (#1, Dec 10 2003, 13:29:44)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
FreeBSD:
FreeBSD users.757.org 4.10-RELEASE-p2 FreeBSD 4.10-RELEASE-p2 #2: Wed Sep 1 00:26:09 EDT 2004
After getting everything all configured and working the way I wanted on my linux workstation, I moved my
install to my FreeBSD webhost.
I started getting this error everytime the script ran:
Traceback (most recent call last):
File "planet.py", line 240, in ?
template = TemplateManager().prepare(template_file)
File "/home/count/planet/htmltmpl.py", line 204, in prepare
precompiled = self.load_precompiled(file)
File "/home/count/planet/htmltmpl.py", line 342, in load_precompiled
self.lock_file(file, LOCK_UN)
File "/home/count/planet/htmltmpl.py", line 275, in lock_file
fcntl.fcntl(fd, fcntl.LOCK_UN)
IOError: [Errno 14] Bad address
After a bit of googling and testing, I changed the function 'lock_file' (line 263 in htmltmpl.py) to use
'fcntl.flock' instead of 'fcntl.fcntl':
263 def lock_file(self, file, lock):
264 """ do something """
(Continue reading)