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 rsc1975
Recipients r.david.murray, rsc1975
Date 2015-08-31.07:35:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1441006508.24.0.513281506925.issue24966@psf.upfronthosting.co.za>
In-reply-to
Content
In my case, I modify the stdout but the error was thrown by a third party (click lib), I need to overwrite the stdout because the program has a CLI and the locale env in the terminal seems to be wrong:
 codecs.lookup(locale.getpreferredencoding()).name == 'ascii'
 sys.getdefaultencoding() == 'utf-8'

For these cases I try to fix it forcing the the IO encoding to the value given by sys.getdefaultencoding(), otherwise the script in a CLI won't work properly. 

I can apply a monkey-patch on the third party method that return "os.get_terminal_size()" if a ValueError exception is thrown, actually, The script is working now with the monkey-patch, but I thought that a bit of more "magic" in get_terminal_size would help to deal with the encoding issues in python3 CLI programs.
History
Date User Action Args
2015-08-31 07:35:08rsc1975setrecipients: + rsc1975, r.david.murray
2015-08-31 07:35:08rsc1975setmessageid: <1441006508.24.0.513281506925.issue24966@psf.upfronthosting.co.za>
2015-08-31 07:35:08rsc1975linkissue24966 messages
2015-08-31 07:35:07rsc1975create