Message249387
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. |
|
Date |
User |
Action |
Args |
2015-08-31 07:35:08 | rsc1975 | set | recipients:
+ rsc1975, r.david.murray |
2015-08-31 07:35:08 | rsc1975 | set | messageid: <1441006508.24.0.513281506925.issue24966@psf.upfronthosting.co.za> |
2015-08-31 07:35:08 | rsc1975 | link | issue24966 messages |
2015-08-31 07:35:07 | rsc1975 | create | |
|