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
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
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
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
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
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
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>
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
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
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
10 matches
Mail list logo