shared file access in python

Jeff Epler jepler at unpythonic.net
Fri Jun 18 17:43:00 EDT 2004


The file() constructor probably takes any second argument that your OS's
fopen() does, though this may have changed with the creation of
universal newlines.

If there's something that os.open() can do that file() can't, you
should be able to achieve it by using os.fdopen(): (untested)
    def magic_file(filename, flag=os.O_RDONLY, mode='r', bufsize=None):
        fd = os.open(filename, flag)
        return os.fdopen(fd, mode, bufsize)

I don't know what _open or fsopen are.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040618/bf1a44e7/attachment.sig>


More information about the Python-list mailing list