Question regarding os.write() and write() method of a file descriptor

phil lemelin phil.lemelin at
Fri Jul 18 14:38:03 CEST 2008

Good Day python users,

I have a question regarding os.write and the write method of a file
descriptor object. My python was written on linux, under python 2.4 and I've
recently migrated to python 2.5.
My problem came from a pipe I used to to open and write to using :

fd ="myfifo","w+")
os.write(fd,'some boring stuff\n')

I'm pretty sure that it worked on a previous version of python and linux
but, on my mandriva 2008, running python 2.5, I get the following exception

os.write(fd,'some boring stuff\n')
exceptions.TypeError: an integer is required

Now, I solved my problem by changing my code to the following :

fd open("myfifo","w+")
fd.write("some less boring stuff\n")

I still cant explain why it works with the file descriptor method and i'm
seeking an explanation.

Please, forgive me if it's a dumb question, but i'm just trying to get
better at python.

I hope someone will take time to help me out.
Philippe-Alexandre Lemelin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list