os.write and file descriptor
Grant Edwards
grante at visi.com
Tue Feb 4 17:20:55 EST 2003
More information about the Python-list mailing list
Tue Feb 4 17:20:55 EST 2003
- Previous message (by thread): pausing or killing a process
- Next message (by thread): os.write and file descriptor
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <3e403b70$0$33320$a1866201 at newsreader.visi.com>, Grant Edwards wrote: > In article <mailman.1044394889.16825.python-list at python.org>, Inyeol Lee wrote: > >> I'm writing a program which writes to file descriptor 3. >> I've tried os.write() but it generates exception; >> >>>>> import os >>>>> os.write(3, "hello") >> Traceback (most recent call last): >> File "<stdin>", line 1, in ? >> OSError: [Errno 9] Bad file number > > What happens if you use 1 or 2 instead of 3? > > Why do you think that 3 should be valid? > >> I've also tried equivalent C code, and it works fine; > > It doesn't for me: > > $cat testit.c > #include <stdio.h> > #include <unistd.h> > #include <string> That Should be: <string.h> Not sure how I got a broken version of the file in the posting... :/ Anyway, it still produces the "correct" error: > $ ./testit > write: Bad file descriptor > >> Is the usage of os.write() different from C? Am I missing >> something? > > No. -- Grant Edwards grante Yow! Finally, Zippy at drives his 1958 RAMBLER visi.com METROPOLITAN into the faculty dining room.
- Previous message (by thread): pausing or killing a process
- Next message (by thread): os.write and file descriptor
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list