[issue24968] Python 3 raises Unicode errors with the xxx.UTF-8 locale

2015-09-01 Thread Roberto Sánchez
Roberto Sánchez added the comment: Ok, that makes sense, besides David pointed me about another opened issue that could help to solve cases like this: http://bugs.python.org/issue15216 If the encoding is wrong because the environment but we can change the initial stream encodings (in stdin

[issue24966] shutil.get_terminal_size() throws ValueError if stdout is detached, no fallback

2015-09-01 Thread Roberto Sánchez
Roberto Sánchez added the comment: Yeah, sorry, actually I was thinking in the stdin/out section, the detach() doc itself is Ok, the problem comes when is called in stdin/out. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue24966] shutil.get_terminal_size() throws ValueError if stdout is detached, no fallback

2015-08-31 Thread Roberto Sánchez
Roberto Sánchez added the comment: 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

[issue24966] shutil.get_terminal_size() throws ValueError if stdout is detached, no fallback

2015-08-31 Thread Roberto Sánchez
Roberto Sánchez added the comment: Thank you for the references, changing the encoding of an open stream sounds interesting, but It's targeted for v. 3.6 so It seems a bit far away. Anyway, as I said I fixed on my side with monkey-patching on the third-party lib, the broken locale is just

[issue24966] shutil.get_terminal_size() throws ValueError if stdout is detached, no fallback

2015-08-31 Thread Roberto Sánchez
Roberto Sánchez added the comment: I totally agree, on the other hand, if the detach() method can cause that some core methods like shutil.get_termina_size() raise an exception then I think that should be warned in the doc of detach(). In all places that I've seen, the detach() method is used

[issue24968] Python 3 raises Unicode errors with the xxx.UTF-8 locale

2015-08-31 Thread Roberto Sánchez
New submission from Roberto Sánchez: System: Python 3.4.2 on Linux Fedora 22 This issues is strongly related with: http://bugs.python.org/issue19846 But It isn't exactly the same case. When I connect from my Mac OSX (using Terminal.app) to a Linux host with Fedora through ssh, the terminal

[issue24966] shutil.get_terminal_size() throws ValueError if stdout is detached, no fallback

2015-08-31 Thread Roberto Sánchez
Roberto Sánchez added the comment: I've added a new issue: http://bugs.python.org/issue24968 that is related with this one, because is the root cause to modify the stdin/stdout streams. -- ___ Python tracker <rep...@bugs.python.org>

[issue24968] Python 3 raises Unicode errors with the xxx.UTF-8 locale

2015-08-31 Thread Roberto Sánchez
Roberto Sánchez added the comment: OK, I already knew that "It is not a bug", but the scenario seems quite common, connection to a Linux host from a Mac with Terminal.app and different locales (default behavior), so a bit of "magic" when the locale's encoding part is

[issue24966] shutil.get_terminal_size() throws ValueError is stdout is detached, no fallback

2015-08-30 Thread Roberto Sánchez
New submission from Roberto Sánchez: After the stdout stream has been overwritten and detached, the method shutils.get_terminal_size throws a ValueError exception and no fallback value is returned. Code to reproduce it: import os, sys, codecs, shutils sys.stdout = codecs.getwriter

[issue24966] shutil.get_terminal_size() throws ValueError if stdout is detached, no fallback

2015-08-30 Thread Roberto Sánchez
Changes by Roberto Sánchez d...@r75.es: -- title: shutil.get_terminal_size() throws ValueError is stdout is detached, no fallback - shutil.get_terminal_size() throws ValueError if stdout is detached, no fallback ___ Python tracker rep