> 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 getattr(se
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
>> original_stdout.write(
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 object
> 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 h
>
> 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
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
>> behavi
>
> 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 sitecustomiz
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 ctype
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>
>
>
> 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
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
11 matches
Mail list logo