Terry J. Reedy <[email protected]> added the comment:
If one starts IDLE from a command-line console (python -m idlelib) or Python
console (import idlelib.idle), sys.__stdout__ is the TextIOWraper for that
console and .fileno() returns 1. .get_terminal_size() will then return the
console size. The exception occurs when IDLE is started from an icon.
Implementing David's suggestion for shutil will be easy: insert just before the
fileno call
if not sys.__stdout__: raise ValueError()
This is what os.get_terminal_size() raises on IDLE. Comments in the code in
posixpath.c make it clear that this is intended guis and the low_level os
function.
This came up today on Stackoverflow when someone tried to use
matplotlib.pyplot, which calls os.get_terminal_size, on IDLE.
https://stackoverflow.com/questions/46921087/pyplot-with-idle
(Patching shutil will not help for the os call.)
----------
nosy: +terry.reedy
stage: -> test needed
type: crash -> behavior
versions: +Python 3.7 -Python 3.4, Python 3.5
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue24920>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com