Question regarding os.write() and write() method of a file descriptor
phil lemelin
phil.lemelin at gmail.com
Fri Jul 18 08:38:03 EDT 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 = os.open("myfifo","w+")
os.write(fd,'some boring stuff\n')
os.close(fd)
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")
fd.close()
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: <http://mail.python.org/pipermail/python-list/attachments/20080718/404b8efe/attachment.html>
More information about the Python-list
mailing list