A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/115845.html below:

locking files on freebsd

locking files on freebsdSteven D. Majewski sdm7g at Virginia.EDU
Mon Apr 2 13:48:21 EDT 2001
On Mon, 2 Apr 2001, Haris Lekatsas wrote:

> Hello,
> I have a problem with locking files. The following code will work on several OS
> but it seems
> to fail on FreeBSD giving an IOError.
> Any ideas?
> 
> f = open('filename', 'w')
> fd = f.fileno()
> flock = struct.pack('2h8l', FCNTL.F_WRLCK, 0, 0, 0, 0, 0, 0, 0, 0, 0)
> fcntl.fcntl(fd, FCNTL.F_SETLKW, flock)

Look at Lib/test/test_fcntl.py and you'll see why.
The layout of the flock struct is different on different unices. 
(Thus the conditional code in the test.) 

-- Steve Majewski



More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4