This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients eryksun, isaacl, paul.moore, r.david.murray, steve.dower, terry.reedy, tim.golden, zach.ware
Date 2017-10-26.01:47:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1508982432.0.0.213398074469.issue24920@psf.upfronthosting.co.za>
In-reply-to
Content
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.)
History
Date User Action Args
2017-10-26 01:47:12terry.reedysetrecipients: + terry.reedy, paul.moore, tim.golden, r.david.murray, zach.ware, eryksun, steve.dower, isaacl
2017-10-26 01:47:12terry.reedysetmessageid: <1508982432.0.0.213398074469.issue24920@psf.upfronthosting.co.za>
2017-10-26 01:47:11terry.reedylinkissue24920 messages
2017-10-26 01:47:10terry.reedycreate