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: 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: References: <53ba11fc$0$29985$c3e8da3$5496439d@news.astraweb.com> <53ba538d$0$2926$c3e8da3$76491128@news.astraweb.com> Date: Mon, 7 Jul 2014 22:55:20 +1000 Subject: Re: open() and EOFError From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Mon, Jul 7, 2014 at 10:39 PM, Roy Smith 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 ^? ^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