Glenn Linderman v+pyt...@g.nevcal.com added the comment:
For the win_console.patch, it seems like adding the line
self.errors='strict'
inside UnicodeOutput.__init__ resolves the problem with input causing
exceptions.
Not sure if the sys_write_stdout.patch has the same sort of problem. Sure
Terry J. Reedy tjre...@udel.edu added the comment:
3.3b0, Win7, 64 bit. Original test script stops at
File C:\Programs\Python33\lib\encodings\cp437.py, line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character
Glenn Linderman v+pyt...@g.nevcal.com added the comment:
A little more empirical info: the missing errors attribute doesn't show up
except for input. print works fine.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
Glenn Linderman v+pyt...@g.nevcal.com added the comment:
I actually had to go back to 3.1.2 to get it to run, I guess I had never run
with Unicode output after installing 3.2. So it isn't an incompatibility
between 3.2.2 and 3.2.3, but more likely a change between 3.1 and 3.2 that
Changes by Brian Curtin br...@python.org:
--
nosy: -brian.curtin
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list
Changes by Giampaolo Rodola' g.rod...@gmail.com:
--
nosy: +giampaolo.rodola
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Giampaolo Rodola' g.rod...@gmail.com added the comment:
Not sure whether a solution has already been proposed because the issue is very
long, but I just bumped into this on Windows and come up with this:
from __future__ import print_function
import sys
def safe_print(s):
try:
David-Sarah Hopwood david-sa...@jacaranda.org added the comment:
Giampaolo: See #msg120700 for why that won't work, and the subsequent comments
for what will work instead (basically, using WriteConsoleW and a workaround for
a Windows API bug). Also see the prototype win_console.patch from
Changes by Matt Mackall m...@selenic.com:
--
nosy: -Matt.Mackall
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list
Glenn Linderman v+pyt...@g.nevcal.com added the comment:
Has something incompatible changed between 3.2.2 and 3.2.3 with respect to this
bug?
I have a program that had an earlier version of the workaround (Michael's
original, I think), and it worked fine, then I upgraded from 3.2.2 to 3.2.3
Glenn Linderman v+pyt...@g.nevcal.com added the comment:
Oh, and is this issues going to be fixed for 3.3, so we don't have to use the
workaround in the future?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
Terry J. Reedy tjre...@udel.edu added the comment:
Glenn, I do not know what you are using the interactive interpreter for, but
for the unicode BMP, the Idle shell generally works better. I only use
CommandPrompt for cross-checking behavior.
--
___
STINNER Victor victor.stin...@gmail.com added the comment:
The issue #14227 has been marked as a duplicate of this issue. Copy of
msg155149:
This is on Windows 7 SP1. Run 'chcp 65001' then Python from a console. Note
the extra characters when non-ASCII characters are in the string. At a
Changes by akira 4kir4...@gmail.com:
--
nosy: +akira
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Matt Mackall m...@selenic.com added the comment:
The underlying cause of Python's write exceptions with cp65001 is:
The ANSI C write() function as implemented by the Windows console returns the
number of _characters_ written rather than the number of _bytes_, which Python
reasonably
STINNER Victor victor.stin...@haypocalc.com added the comment:
I added a cp65001 codec to Python 3.3: see issue #13216.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
STINNER Victor victor.stin...@haypocalc.com added the comment:
I done more tests on the Windows console. I focused my tests on output.
To sum up, if we implement sys.stdout using WriteConsoleW() and
sys.stdout.buffer.raw using WriteConsoleA():
- print() will not fail anymore on unencodable
STINNER Victor victor.stin...@haypocalc.com added the comment:
unicode3.py replaces sys.stdout, sys.stdout.buffer, sys.stderr and
sys.stderr.buffer to use WriteConsoleW() and WriteConsoleA(). It displays also
a lot of information about encodings and displays some characters (I wrote my
tests
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +brian.curtin, mhammond
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
STINNER Victor victor.stin...@haypocalc.com added the comment:
win_console.patch: a more complete prototype
* patch the site module to replace sys.stdout and sys.stderr by UnicodeConsole
and BytesConsole classes which use WriteConsoleW and WriteConsoleA
* UnicodeConsole inherits from
STINNER Victor victor.stin...@haypocalc.com added the comment:
test_win_console.py: Small script to test win_console.patch. Write some
characters into sys.stdout.buffer (WriteConsoleA) and sys.stdout
(WriteConsoleW). The test is written for cp850, cp1252 and cp65001 code pages.
--
Changes by pyloz merlinschindlb...@googlemail.com:
--
nosy: +smerlin
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list
David-Sarah Hopwood david-sa...@jacaranda.org added the comment:
Glenn wrote:
So if flush checks that bit, maybe TextIOWriter could just call buffer.flush,
and it would be fast if clean and slow if dirty?
Yes. I'll benchmark how much overhead is added by the calls to flush; there's
no point
Glenn Linderman v+pyt...@g.nevcal.com added the comment:
David-Sarah wrote:
Windows is very slow at scrolling a console, which might make the cost of
flushing insignificant in comparison.)
Just for the record, I noticed a huge speedup in Windows console scrolling when
I switched from WinXP to
David-Sarah Hopwood david-sa...@jacaranda.org added the comment:
First a minor correction:
The new requirement would be that a correct app also needs to flush between a
sequence of buffer.writes (that end in an incomplete line, or always if
PYTHONUNBUFFERED or python -u is used), and a
David-Sarah Hopwood david-sa...@jacaranda.org added the comment:
I wrote:
A similar issue arises for stdin: to maintain strict compatibility, every
read from a TextIOWrapper attached to an input console would have to drain
the buffer of its buffer object, in case the app has read from it.
Changes by Brian Curtin br...@python.org:
--
nosy: -brian.curtin
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list
Glenn Linderman v+pyt...@g.nevcal.com added the comment:
David-Sarah said:
In any case, given that the buffer of the initial std{out,err} will always be a
BufferedWriter object (since .buffer is readonly), it would be possible for the
TextIOWriter to test a dirty flag in the BufferedWriter, in
David-Sarah Hopwood david-sa...@jacaranda.org added the comment:
I wrote:
The only caveat would be that if you write a partial line to the buffer
object (or if you set the buffer object to be fully buffered and write to
it), and then write to the text stream, the buffer wouldn't be flushed
David-Sarah Hopwood david-sa...@jacaranda.org added the comment:
I wrote:
$ python3 -c 'import sys; sys.stdout.write(foo);
sys.stdout.buffer.write(bbar); sys.stdout.write(baz\n)'
barfoobaz
Hmm, the behaviour actually would differ here: the proposed implementation
would print
foobaz
bar
(the
Glenn Linderman v+pyt...@g.nevcal.com added the comment:
Presently, a correct application only needs to flush between a sequence of
writes and a sequence of buffer.writes.
Don't assume the flush happens after every write, for a correct application.
--
David-Sarah Hopwood david-sa...@jacaranda.org added the comment:
Glenn Linderman wrote:
Presently, a correct application only needs to flush between a sequence of
writes and a sequence of buffer.writes.
Right. The new requirement would be that a correct app also needs to flush
between a
Glenn Linderman v+pyt...@g.nevcal.com added the comment:
Would it suffice if the new scheme internally flushed after every buffer.write?
It wouldn't be needed after write, because the correct application would
already do one there?
Am I off-base in supposing that the performance of
STINNER Victor victor.stin...@haypocalc.com added the comment:
Le vendredi 25 mars 2011 à 00:54 +, David-Sarah Hopwood a écrit :
David-Sarah Hopwood david-sa...@jacaranda.org added the comment:
I wrote:
$ python3 -c 'import sys; sys.stdout.write(foo);
sys.stdout.buffer.write(bbar);
David-Sarah Hopwood david-sa...@jacaranda.org added the comment:
(For anyone wondering about the hold-up on this bug, I ended up switching to
Ubuntu. Not to worry, I now have Python 3 building in XP under VirtualBox --
which is further than I ever got with my broken Vista install :-/ It seems
STINNER Victor victor.stin...@haypocalc.com added the comment:
I did some tests with WriteConsoleW():
- with raster fonts, U+00E9 is displayed as é, U+0141 as L and U+042D as ? =
good (work as expected)
- with TrueType font (Lucida), U+00E9 is displayed as é, U+0141 as Ł and
U+042D as Э =
Changes by Santoso Wijaya santoso.wij...@gmail.com:
--
nosy: +santa4nt
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list
Changes by Andrew Dunbar hippytr...@gmail.com:
--
nosy: +hippietrail
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list
David-Sarah Hopwood david-sa...@jacaranda.org added the comment:
Feedback from Julie Solon of Microsoft:
These console functions share a per-process heap that is 64K. There is some
overhead, the heap can get fragmented, and calls from multiple threads all
affect how much is available for
sorin sorin.sbar...@gmail.com added the comment:
remeber that cp65001 cannot be set on windows. Also please read
http://blogs.msdn.com/b/michkap/archive/2010/10/07/10072032.aspx and contact
the author, Michael Kaplan from Microsoft, if you have more questions. I'm sure
he will be glad to
Terry J. Reedy tjre...@udel.edu added the comment:
http://www.python.org/dev/peps/pep-0011/ says
Name: Win9x, WinME, NT4
Unsupported in: Python 2.6 (warning in 2.5 installer)
Code removed in: Python 2.6
Only xp+ now. email sent to webmaster@...
Even if the best fix only
Brian Curtin cur...@acm.org added the comment:
I think we even agreed to drop 2000, although the PEP hasn't been updated and I
couldn't find the supposed email where this was said.
For implementing functionality that isn't supported on all Windows versions or
architectures, you can look at
STINNER Victor victor.stin...@haypocalc.com added the comment:
Here are some results of my test of unicode2.py. I'm testing py3k on Windows
XP, OEM: cp850, ANSI: cp1252.
Raster fonts
With a fresh console, unicode2.py displays ?. input() accepts
characters
STINNER Victor victor.stin...@haypocalc.com added the comment:
..., because right now, I'm including instructions for the use to
(1) choose Lucida or Consolas font if they can't figure out
any other font that gets rid of the square boxes
(2) chcp 65001
(3) set PYTHONIOENCODING=UTF-8
Glenn Linderman v+pyt...@g.nevcal.com added the comment:
Victor said:
Why do you set the code page to 65001? In all my tests (on Windows XP), it
always break the standard input.
My response:
Because when I searched Windows for Unicode and/or UTF-8 stuff, I found 65001,
and it seems like it
Changes by David-Sarah Hopwood david-sa...@jacaranda.org:
--
title: windows console doesn't print utf8 (Py30a2) - windows console doesn't
print or input Unicode
Added file: http://bugs.python.org/file20363/doc-patch.diff
___
Python tracker
101 - 146 of 146 matches
Mail list logo