open() and EOFError
Chris Angelico
rosuav at gmail.com
Mon Jul 7 08:55:20 EDT 2014
On Mon, Jul 7, 2014 at 10:39 PM, Roy Smith <roy at panix.com> wrote:
> $ stty -e
> speed 9600 baud; 24 rows; 80 columns;
> lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
> -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
> -extproc
> iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8
> -ignbrk brkint -inpck -ignpar -parmrk
> oflags: opost onlcr -oxtabs -onocr -onlret
> cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
> -dtrflow -mdmbuf
> discard dsusp eof eol eol2 erase intr kill lnext
> ^O ^Y ^D <undef> <undef> ^? ^C ^U ^V
> min quit reprint start status stop susp time werase
> 1 ^\ ^R ^Q ^T ^S ^Z 0 ^W
Not sure what you're running, but 'stty -e' throws an error for me
(Debian Wheezy). I get fairly similar output from 'stty -a', though;
and it's marginally more parseable:
rosuav at sikorsky:~$ stty -a
rosuav at sikorsky:~$ stty -a
speed 38400 baud; rows 55; columns 190; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?;
eol2 = M-^?; swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt =
^R; werase = ^W; lnext = ^V; flush = ^O;
min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon
-ixoff -iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop
-echoprt echoctl echoke
(That's off a maximized window. If I restore the window, I get a more
classic 24x80.)
The same info can be queried in Python via
termios.tcgetattr()[6][termios.VEOF] but you then have to parse that
to interpret it for a human (it comes out as b'\4', which you have to
figure out means ^D). I'm not sure if there's a utility function
anywhere for "give me the human readable form of this".
ChrisA
More information about the Python-list
mailing list