Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74102

Re: open() and EOFError

Path csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'output': 0.05; 'discard': 0.07; 'rows': 0.09; 'throws': 0.09; 'window.': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; '(it': 0.16; 'columns': 0.16; 'eof': 0.16; 'flush': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'readable': 0.16; 'roy': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'error': 0.23; 'interpret': 0.24; 'parse': 0.24; 'fairly': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'figure': 0.32; 'info': 0.35; 'anywhere': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'similar': 0.36; 'pm,': 0.38; 'sure': 0.39; 'skip:t 30': 0.61; "you're": 0.61; 'more': 0.64; 'smith': 0.68; 'jul': 0.74; 'restore': 0.78; 'maximized': 0.84; 'min': 0.84; 'reprint': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=tHjk74OjvXdw2lAh1UQp4N+uWCgZ3fybuO9hiZpoBK4=; b=G02EY6X/pnRQRFoffKGBA1eDHL1vZyx8ikcJu1ltZzPPcq6AFi4apIoN4hcrmWkMmT pZvf1c1UvAGW00a5LEpjMfbvGpokI3AG3mTkEc/GeyDGjkifC4YQz02lqdqP8zdpWrsr e+5/2yXXajqAD6rvOj7i0qWSK7TnM/nM75/6tiRSjNKRibpy8RWp1aujRgTPQv7NCFKP lwTFW7dwDnsLy7WJ3Jy01QDiIuUaK2PICKakWN1ltb6/q1JgT/QYfOgXvKO3uL/A89Pn mI7e+kDX7HEed3rhAb9C79s5GlbB7GKpnmXkEag+Cv2pF8+UWulns++8MN+QSZdJa2J1 oJug==
MIME-Version 1.0
X-Received by 10.53.7.204 with SMTP id de12mr10504700vdd.41.1404737720764; Mon, 07 Jul 2014 05:55:20 -0700 (PDT)
In-Reply-To <roy-BE5640.08390407072014@news.panix.com>
References <53ba11fc$0$29985$c3e8da3$5496439d@news.astraweb.com> <c1uo2eF60gfU1@mid.individual.net> <53ba538d$0$2926$c3e8da3$76491128@news.astraweb.com> <roy-BE5640.08390407072014@news.panix.com>
Date Mon, 7 Jul 2014 22:55:20 +1000
Subject Re: open() and EOFError
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11588.1404737728.18130.python-list@python.org> (permalink)
Lines 44
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1404737728 news.xs4all.nl 2839 [2001:888:2000:d::a6]:32887
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:74102

Show key headers only | View raw


On Mon, Jul 7, 2014 at 10:39 PM, Roy Smith <roy@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@sikorsky:~$ stty -a
rosuav@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

open() and EOFError Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-07 03:20 +0000
  Re: open() and EOFError Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-07-07 17:04 +1200
    Re: open() and EOFError Steven D'Aprano <steve@pearwood.info> - 2014-07-07 08:00 +0000
      Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-07 18:09 +1000
      Re: open() and EOFError Dave Angel <davea@davea.name> - 2014-07-07 08:14 -0400
      Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-07 22:19 +1000
        Re: open() and EOFError Roy Smith <roy@panix.com> - 2014-07-07 08:46 -0400
          Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-07 22:58 +1000
            Re: open() and EOFError Roy Smith <roy@panix.com> - 2014-07-07 20:26 -0400
          Re: open() and EOFError Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-07-08 09:50 +1200
        Re: open() and EOFError Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-07 15:45 +0000
          Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-08 01:53 +1000
          Re: open() and EOFError Marko Rauhamaa <marko@pacujo.net> - 2014-07-07 19:08 +0300
            Re: open() and EOFError Marko Rauhamaa <marko@pacujo.net> - 2014-07-07 19:12 +0300
      Re: open() and EOFError Roy Smith <roy@panix.com> - 2014-07-07 08:39 -0400
        Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-07 22:55 +1000
          Re: open() and EOFError Roy Smith <roy@panix.com> - 2014-07-07 20:28 -0400
        Re: open() and EOFError Terry Reedy <tjreedy@udel.edu> - 2014-07-07 14:49 -0400
          Re: open() and EOFError Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-07-08 10:04 +1200
            Re: open() and EOFError Grant Edwards <invalid@invalid.invalid> - 2014-07-08 14:19 +0000
              Re: open() and EOFError Terry Reedy <tjreedy@udel.edu> - 2014-07-08 11:08 -0400
              Re: open() and EOFError Tim Chase <python.list@tim.thechases.com> - 2014-07-08 10:20 -0500
              Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-09 01:24 +1000
              Re: open() and EOFError Tim Chase <python.list@tim.thechases.com> - 2014-07-08 10:46 -0500
                Re: open() and EOFError Roy Smith <roy@panix.com> - 2014-07-08 21:05 -0400
                Re: open() and EOFError Anssi Saari <as@sci.fi> - 2014-07-10 22:40 +0300
              Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-09 01:49 +1000
              Re: ^D vs ^Z as EOF and DOS dinosaurs talking (was: open() and EOFError) Tim Chase <python.list@tim.thechases.com> - 2014-07-08 10:57 -0500
                Re: ^D vs ^Z as EOF and DOS dinosaurs talking (was: open() and EOFError) Jan van den Broek <balglaas@xs4all.nl> - 2014-07-08 16:38 +0000
              Re: ^D vs ^Z as EOF and DOS dinosaurs talking (was: open() and EOFError) Chris Angelico <rosuav@gmail.com> - 2014-07-09 02:20 +1000
              Re: open() and EOFError Tim Chase <python.list@tim.thechases.com> - 2014-07-08 11:40 -0500
              Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-09 02:50 +1000
          Re: open() and EOFError Steven D'Aprano <steve@pearwood.info> - 2014-07-08 09:03 +0000
            Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-08 20:29 +1000
      Re: open() and EOFError Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-07 14:06 +0100
      Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-07 23:27 +1000
      Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-07 23:29 +1000
      Re: open() and EOFError Dan Stromberg <drsalists@gmail.com> - 2014-07-07 09:07 -0700
      Re: open() and EOFError Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-07 11:25 -0600
        Re: open() and EOFError Marko Rauhamaa <marko@pacujo.net> - 2014-07-07 20:31 +0300
          Re: open() and EOFError Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-07 18:07 +0000
            Re: open() and EOFError Marko Rauhamaa <marko@pacujo.net> - 2014-07-07 21:42 +0300
            Re: open() and EOFError Roy Smith <roy@panix.com> - 2014-07-07 20:22 -0400
          Re: open() and EOFError Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-07-08 10:09 +1200
            Re: open() and EOFError Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-08 00:10 +0100
            Re: open() and EOFError "Neil D. Cerutti" <neilc@norwich.edu> - 2014-07-08 10:29 -0400
      Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-08 03:29 +1000
        Re: open() and EOFError Marko Rauhamaa <marko@pacujo.net> - 2014-07-07 20:40 +0300
          Re: open() and EOFError Chris Angelico <rosuav@gmail.com> - 2014-07-08 10:55 +1000
      Re: open() and EOFError Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-07-07 18:54 -0400

csiph-web