classification
Title: print unicode string error in win8 cmd console
Type: behavior Stage:
Components: IO Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: brian.curtin, giampaolo.rodola, loewis, nkxyz, tim.golden, vstinner
Priority: normal Keywords:

Created on 2012-03-02 03:43 by nkxyz, last changed 2012-03-05 21:13 by loewis.

Messages (6)
msg154724 - (view) Author: nkxyz (nkxyz) Date: 2012-03-02 03:43
print u'测试中文'

睺raceback (most recent call last):
  File "C:\Users\__test.py", line 96, in <module>
    sys.exit(main())
  File "C:\Users\__test.py", line 84, in main
    print u'娴嬭瘯涓枃'
IOError: [Errno 28] No space left on device

the unicode must start with a ascii char, then print can works
like this: "print u' 测试中文'"
msg154740 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-03-02 06:26
What is the code page of your console (try: "chcp").
msg154770 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012-03-02 15:33
It looks like a duplicate of the issue #11395 which has been fixed in
Python 3.2.1, but not backported to Python 2.7. Can you please try
your program with Python 3.2.1? And maybe also attach the whole test
script?
msg154958 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-03-05 16:19
Victor: why do you think this is a duplicate of #11395? That issue deals with long output strings, which doesn't seem to be the case here.
msg154962 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012-03-05 16:40
> Victor: why do you think this is a duplicate of #11395? That issue deals with long output strings, which doesn't seem to be the case here.

IOError('[Errno 28] No space left on device') was exactly the #11395
error message. Without the full test script, i cannot be sure that
it's a duplicate. "C:\Users\__test.py, line 96": it looks like the
program has ~100 lines and so may write something else to the console.
There are buffers in TextIOWrapper, BufferedWriter and the Windows
console itself. By the way, Python maps the Windows error
ERROR_DISK_FULL (112) to ENOSPC (28).

It's maybe something completly different.
msg154975 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-03-05 21:13
> IOError('[Errno 28] No space left on device') was exactly the #11395
> error message. 

I read that report differently:

IOError: [Errno 12] Not enough space

ENOMEM != ENOSPC
History
Date User Action Args
2012-03-05 21:13:57loewissetmessages: + msg154975
2012-03-05 16:56:33pitrousetnosy: + tim.golden, brian.curtin
2012-03-05 16:40:34vstinnersetmessages: + msg154962
2012-03-05 16:19:35loewissetmessages: + msg154958
2012-03-02 15:33:19vstinnersetmessages: + msg154770
2012-03-02 15:24:46pitrousetnosy: + vstinner
2012-03-02 09:47:55giampaolo.rodolasetnosy: + giampaolo.rodola
2012-03-02 06:26:30loewissetnosy: + loewis
messages: + msg154740
2012-03-02 03:44:55nkxyzsettitle: print unicode string error in cmd console -> print unicode string error in win8 cmd console
2012-03-02 03:43:31nkxyzcreate