Python Forum
io.UnsupportedOperation: fileno
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
io.UnsupportedOperation: fileno
#1
I'm using Python 3.11.4 (64-bit) on windows 11.
I've installed libraries from the book, Introduction to Python Programming.
One of these is called stdio. From a Python prompt, I can import stdio and it works fine.
When I try to run the following program from IDLE, however, I get the error message below.

#-----------------------------------------------------------------------
# helloworld.py
#-----------------------------------------------------------------------

import stdio

# Write 'Hello, World' to standard output.
stdio.writeln('Hello, World')
Traceback (most recent call last):
File "D:\LANGS\Python Programs\introcs-python\helloworld.py", line 5, in <module>
import stdio
File "C:\Users\tlake\AppData\Roaming\Python\Python311\site-packages\stdio.py", line 31, in <module>
sys.stdin = open(sys.stdin.fileno(), 'r', newline=None)
io.UnsupportedOperation: fileno


What's going on?
Reply
#2
IDLE is what is going on. IDLE replaces stdin (io.TextIOWrapper) with it's own stdin (idlelib.run.StdInputFile). IDLE pulls this kind of trickery in other places too, making it just different enough that I have long given up using IDLE for anything.
Reply
#3
You could use Thonny instead of IDLE, another Python IDE for beginners.
Reply
#4
(Jun-13-2023, 05:50 AM)Gribouillis Wrote: You could use Thonny instead of IDLE, another Python IDE for beginners.
Thanks! Thonny is just what I needed.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  io.UnsupportedOperation: not readable RedSkeleton007 2 18,788 Nov-06-2023, 06:32 AM
Last Post: gpurdy
  io.UnsupportedOperation: not readable navidmo 1 3,535 Oct-31-2019, 11:04 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020