En Tue, 11 Sep 2007 07:58:03 -0300, Fabio Zadrozny [EMAIL PROTECTED]
escribi�:
You could place code like that on sitecustomize.py
I think this should be fixed on Eclipse/pydev. If they replace
sys.stdout
with a different object - they should make sure it has the right
behavior.
Same
But I don't think it's a good idea. Changing the default encoding will
change it for *all* scripts, *all* users, *all* objects. And AFAIK you
have trouble ONLY with sys.std* - one should fix those objects, not mess
with a global configuration.
Makes sense... Do you think that creating a new
On Behalf Of Fabio Zadrozny
Makes sense... Do you think that creating a new object,
setting it as sys.stdout and overriding its write() method to
check for a unicode string to do
original_stdout.write(unicode_str.encode(my_encoding)) would
do it?
Here's an output stream encoder I have
En Thu, 13 Sep 2007 08:43:11 -0300, Ryan Ginstrom [EMAIL PROTECTED]
escribi�:
On Behalf Of Fabio Zadrozny
Makes sense... Do you think that creating a new object,
setting it as sys.stdout and overriding its write() method to
check for a unicode string to do
En Thu, 13 Sep 2007 08:08:39 -0300, Fabio Zadrozny [EMAIL PROTECTED]
escribi�:
But I don't think it's a good idea. Changing the default encoding will
change it for *all* scripts, *all* users, *all* objects. And AFAIK you
have trouble ONLY with sys.std* - one should fix those objects, not
On Behalf Of Gabriel Genellina
You should check that obj is an unicode object before calling
encode.
Strings should not be encoded.
...
__getattr__ is only called when the attribute has NOT been
found in the usual way, so checking for write is
unnecesary. Just return
You could place code like that on sitecustomize.py
I think this should be fixed on Eclipse/pydev. If they replace sys.stdout
with a different object - they should make sure it has the right behavior.
Same for IDLE if it's broken too.
Thanks for the tip... I wasn't aware of sitecustomize.py
En Sun, 09 Sep 2007 17:49:14 -0300, Fabio Zadrozny [EMAIL PROTECTED]
escribi?:
Does someone know if there's a way to explicitly set the stdout/stderr/
stdin
encoding that python should use?
The encoding can be set using the C API for file objects - from Python
code, use ctypes:
py from ctypes
Does someone know if there's a way to explicitly set the stdout/stderr/
stdin
encoding that python should use?
The encoding can be set using the C API for file objects - from Python
code, use ctypes:
Yeap, but that would leave me with the original problem: I need to run a
script to run
En Sun, 09 Sep 2007 17:49:14 -0300, Fabio Zadrozny [EMAIL PROTECTED]
escribi�:
Does someone know if there's a way to explicitly set the
stdout/stderr/stdin
encoding that python should use?
The encoding can be set using the C API for file objects - from Python
code, use ctypes:
py from
En Mon, 10 Sep 2007 10:02:42 -0300, Fabio Zadrozny [EMAIL PROTECTED]
escribi�:
Does someone know if there's a way to explicitly set the stdout/stderr/
stdin
encoding that python should use?
The encoding can be set using the C API for file objects - from Python
code, use ctypes:
Yeap,
Hi,
Does someone know if there's a way to explicitly set the stdout/stderr/stdin
encoding that python should use?
What I'm trying to do is make python recognize that the Eclipse output
accepts a different encoding (such as utf-8, cp1252, etc). More details on
the problem can be found at:
12 matches
Mail list logo