473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Re: Changing the (codec) error handler for the stdout/stderr streamsin Python 3.0

Jukka Aho wrote:
Just a tip for those who are only just cutting their teeth on Python 3.0
and might have encountered the same problem as I did:

When a Python (3.x) program is run on a terminal that only supports a
legacy character encoding - such as Latin 1 or Codepage 437 - all
characters printed to stdout will be automatically converted from the
interpreter's internal Unicode representation to this legacy character set.
Python 5 is even stricter. Only ASCII (chars 0..127) can be sent
to standard output by default.

John Nagle
Sep 2 '08 #1
2 1097
On Tue, 02 Sep 2008 09:57:05 -0700, John Nagle wrote:
Jukka Aho wrote:
>Just a tip for those who are only just cutting their teeth on Python
3.0 and might have encountered the same problem as I did:

When a Python (3.x) program is run on a terminal that only supports a
legacy character encoding - such as Latin 1 or Codepage 437 - all
characters printed to stdout will be automatically converted from the
interpreter's internal Unicode representation to this legacy character
set.

Python 5 is even stricter. Only ASCII (chars 0..127) can be sent
to standard output by default.

Python 5??? Is this the time machine again?

--
Steven
Sep 2 '08 #2
John Nagle wrote:
Python 5 is even stricter. Only ASCII (chars 0..127) can be sent
to standard output by default.
Python 5? (I guess I haven't been following these things enough...)

Well, I would sure hope not.

--
znark

Sep 2 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Xeon | last post by:
Hi, Is there anyway to set a custom error handler which is actually a method of a class? i.e. setting the method eh() of class foo as error handler in the snippet below. class foo { function...
2
by: Andrei D. | last post by:
Hello Python newsgroup, In the process of developing a big ssh wrapper for sending commands to multiple hosts over the last few months, I (almost accidentally, considering I'm really just an...
5
by: Yoav | last post by:
I use the following code to the console output: def get_console(cmd): try: p_in, p_out, p_err = os.popen3(cmd) except: pass out_str = '' for obj in p_out: out_str = out_str + obj
2
by: velle | last post by:
My headache is growing while playing arround with unicode in Python, please help this novice. I have chosen to divide my problem into a few questions. Python 2.3.4 (#1, Feb 2 2005, 12:11:53) ...
5
by: Wesley Henwood | last post by:
To capture output from python scripts run from a C++ app I've added the following code at the beggening of the C++ app: PyRun_SimpleString("import grabber"); PyRun_SimpleString("import sys");...
2
by: Massi | last post by:
Hi everyone! I'm writing a python script which uses a C-written dll. I call the functions in the dll using ctypes, but I don't know how to catch the output of the "printf" which the C functions...
3
by: Wolfram | last post by:
I have a problem with displaying errors in an embedded situation. The "main program" I want to embed Python into is a windows, MFC, non-console, C++ application. My issue is that I have not been...
4
by: Oleg Parashchenko | last post by:
Hello, I'm working on an unicode-aware application. I like to use "print" to debug programs, but in this case it was nightmare. The most popular result of "print" was: UnicodeDecodeError:...
5
by: Grant Edwards | last post by:
I'm trying to use the py-gnuplot module on windows, and have been unable to get it to work reliably under Win2K and WinXP. By default, it uses popen(gnuplotcmd,'w'), but in some situations that...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.