Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80762
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Nobody <nobody@nowhere.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: fileno() not supported in Python 3.1 |
| Date | Fri, 14 Nov 2014 13:59:30 +0000 |
| Organization | A noiseless patient Spider |
| Lines | 26 |
| Message-ID | <pan.2014.11.14.13.59.28.822000@nowhere.invalid> (permalink) |
| References | <bcc9a923-4a68-45b2-9854-a6f750e71ee7@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | mx02.eternal-september.org; posting-host="152d4dee6f95183c956ee6fa63d7e69f"; logging-data="29455"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+F5DRJ613jXmIglCmgKHfN" |
| User-Agent | Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) |
| Cancel-Lock | sha1:DS/9QWCJ6r9f25bvquDQNj0GHlE= |
| Xref | csiph.com comp.lang.python:80762 |
Show key headers only | View raw
On Thu, 13 Nov 2014 15:48:32 -0800, satishmlmlml wrote: > import sys > for stream in (sys.stdin, sys.stdout, sys.stderr): > print(stream.fileno()) > > > io.UnsupportedOperation: fileno > > Is there a workaround? Try: sys.stdin.buffer.fileno() or maybe sys.stdin.buffer.raw.fileno() In Python 3.x, sys.stdin isn't actually a "file", it's a TextIOWrapper around a BufferedReader around a file (io.FileIO). TextIOWrapper is responsible for converting a stream of bytes to a stream of (Unicode) characters. BufferedReader is responsible for buffering (like C stdio).
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
fileno() not supported in Python 3.1 satishmlmlml@gmail.com - 2014-11-13 15:48 -0800
Re: fileno() not supported in Python 3.1 Ben Finney <ben+python@benfinney.id.au> - 2014-11-14 10:57 +1100
Re: fileno() not supported in Python 3.1 satishmlmlml@gmail.com - 2014-11-13 16:08 -0800
Re: fileno() not supported in Python 3.1 Ben Finney <ben+python@benfinney.id.au> - 2014-11-14 13:52 +1100
Re: fileno() not supported in Python 3.1 Cameron Simpson <cs@zip.com.au> - 2014-11-14 18:36 +1100
Re: fileno() not supported in Python 3.1 Nobody <nobody@nowhere.invalid> - 2014-11-14 13:59 +0000
Re: fileno() not supported in Python 3.1 Joel Goldstick <joel.goldstick@gmail.com> - 2014-11-14 09:09 -0500
Re: fileno() not supported in Python 3.1 Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-14 09:51 -0700
Re: fileno() not supported in Python 3.1 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-15 22:23 +1100
Re: fileno() not supported in Python 3.1 Dan Stromberg <drsalists@gmail.com> - 2014-11-15 21:25 -0800
Re: fileno() not supported in Python 3.1 Chris Angelico <rosuav@gmail.com> - 2014-11-16 16:29 +1100
csiph-web