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


Groups > comp.lang.python > #80717 > unrolled thread

io.UnsupportedOperation: fileno

Started bysatishmlmlml@gmail.com
First post2014-11-13 15:23 -0800
Last post2014-11-14 12:29 +0100
Articles 9 — 6 participants

Back to article view | Back to comp.lang.python


Contents

  io.UnsupportedOperation: fileno satishmlmlml@gmail.com - 2014-11-13 15:23 -0800
    Re: io.UnsupportedOperation: fileno sohcahtoa82@gmail.com - 2014-11-13 15:30 -0800
      Re: io.UnsupportedOperation: fileno satishmlmlml@gmail.com - 2014-11-13 15:34 -0800
        Re: io.UnsupportedOperation: fileno Chris Angelico <rosuav@gmail.com> - 2014-11-14 10:40 +1100
        Re: io.UnsupportedOperation: fileno Ben Finney <ben+python@benfinney.id.au> - 2014-11-14 10:42 +1100
        Re: io.UnsupportedOperation: fileno Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-14 05:10 +0000
      Re: io.UnsupportedOperation: fileno satishmlmlml@gmail.com - 2014-11-13 15:42 -0800
        Re: io.UnsupportedOperation: fileno Ben Finney <ben+python@benfinney.id.au> - 2014-11-14 10:52 +1100
        Re: io.UnsupportedOperation: fileno Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2014-11-14 12:29 +0100

#80717 — io.UnsupportedOperation: fileno

Fromsatishmlmlml@gmail.com
Date2014-11-13 15:23 -0800
Subjectio.UnsupportedOperation: fileno
Message-ID<b501dd95-8ef0-476d-90ff-bf7b44894679@googlegroups.com>
import sys
for stream in (sys.stdin, sys.stdout, sys.stderr):
           print(stream.fileno())


io.UnsupportedOperation: fileno

[toc] | [next] | [standalone]


#80718

Fromsohcahtoa82@gmail.com
Date2014-11-13 15:30 -0800
Message-ID<5afd4b4e-e0cd-4436-b15a-936637b4fe2b@googlegroups.com>
In reply to#80717
On Thursday, November 13, 2014 3:23:24 PM UTC-8, satish...@gmail.com wrote:
> import sys
> for stream in (sys.stdin, sys.stdout, sys.stderr):
>            print(stream.fileno())
> 
> 
> io.UnsupportedOperation: fileno

Yup.  That's what I'd expect to see.

[toc] | [prev] | [next] | [standalone]


#80719

Fromsatishmlmlml@gmail.com
Date2014-11-13 15:34 -0800
Message-ID<d5a61ebb-b317-4dc0-ae9e-cb3bfef28fea@googlegroups.com>
In reply to#80718
What is the problem and how to overcome this problem?

[toc] | [prev] | [next] | [standalone]


#80724

FromChris Angelico <rosuav@gmail.com>
Date2014-11-14 10:40 +1100
Message-ID<mailman.15798.1415922067.18130.python-list@python.org>
In reply to#80719
On Fri, Nov 14, 2014 at 10:34 AM,  <satishmlmlml@gmail.com> wrote:
> What is the problem and how to overcome this problem?

The problem is that you're posting, with no context, a query relating
to a former post which gave scanty information and no indication of
what you expected. To overcome this, read this:

http://www.catb.org/esr/faqs/smart-questions.html

ChrisA

[toc] | [prev] | [next] | [standalone]


#80727

FromBen Finney <ben+python@benfinney.id.au>
Date2014-11-14 10:42 +1100
Message-ID<mailman.15799.1415922307.18130.python-list@python.org>
In reply to#80719
satishmlmlml@gmail.com writes:

> What is the problem and how to overcome this problem?

First, please provide context (just as the previous respondent did), so
your message may be understood in the absence of those prior.
<URL:https://en.wikipedia.org/wiki/Posting_style#Interleaved_style>

As to your question: Please describe what you expected, and how the
behaviour was different. Unless we know what you think is wrong, we
don't know what “the problem” is.

-- 
 \     “Sittin' on the fence, that's a dangerous course / You can even |
  `\       catch a bullet from the peace-keeping force” —Dire Straits, |
_o__)                                   _Once Upon A Time In The West_ |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#80739

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-11-14 05:10 +0000
Message-ID<mailman.15806.1415941860.18130.python-list@python.org>
In reply to#80719
On 13/11/2014 23:34, satishmlmlml@gmail.com wrote:
> What is the problem and how to overcome this problem?
>

RTFM.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#80725

Fromsatishmlmlml@gmail.com
Date2014-11-13 15:42 -0800
Message-ID<b4f3265d-0286-4539-909f-d9e7644277f7@googlegroups.com>
In reply to#80718
fileno() in not supported. Is it only in 3.1? What is the workaround?

[toc] | [prev] | [next] | [standalone]


#80729

FromBen Finney <ben+python@benfinney.id.au>
Date2014-11-14 10:52 +1100
Message-ID<mailman.15800.1415922741.18130.python-list@python.org>
In reply to#80725
satishmlmlml@gmail.com writes:

> fileno() in not supported.

It is supported, but it is behaving as the documentation describes
<URL:https://docs.python.org/3/library/io.html#io.IOBase.fileno>.

> Is it only in 3.1? What is the workaround?

Expect an exception when you ask for the file descriptor on a stream
that does not use a file descriptor.

-- 
 \       “Pinky, are you pondering what I'm pondering?” “Well, I think |
  `\       so, Brain, but ‘apply North Pole’ to what?” —_Pinky and The |
_o__)                                                           Brain_ |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#80756

FromThomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
Date2014-11-14 12:29 +0100
Message-ID<m44p2i$tch$1@r01.glglgl.de>
In reply to#80725
Am 14.11.2014 00:42 schrieb satishmlmlml@gmail.com:
> fileno() in not supported. Is it only in 3.1? What is the workaround?

You have been asked many times about the details of your environment.

Especially, you have been told that it is important to know if you 
directly use the Python CLI or some GUI like IDLE.

I just tested the latter thing and found out that it indeed makes a 
difference, as it introduces a replacement for the std* stuff you are 
missing:

 >>> sys.stdin
<idlelib.PyShell.PseudoInputFile object at 0x0000000002EAD588>
 >>> sys.stdout
<idlelib.PyShell.PseudoOutputFile object at 0x0000000002EAD5C0>
 >>> sys.stderr
<idlelib.PyShell.PseudoOutputFile object at 0x0000000002EAD5F8>

Calling .fileno() on such a Pseudo*File just raises an 
UnsupportedOperation exception.

This is in contrast to using the CLI directly.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web