[issue12337] Need real TextIOWrapper for stdin/stdout

2011-06-14 Thread Fan Decheng

New submission from Fan Decheng fandech...@gmail.com:

Since -u is made default and binary stdio implemented in 3.2, many of my 
scripts cannot run directly in Python 3.2, because they expect \n from stdin, 
but on Windows \r\n is got.

Since that binary stdio being default is necessary for features like CGI, what 
I am expecting is to get a real TextIOWrapper for stdin, so that I can still 
use my old code. Besides, type(sys.stdio) should no longer say TextIOWrapper, 
because TextIOWrapper implies the conversion from \r\n to \n.

Steps to reproduce:
In Python 3.2:
 import sys
 type(sys.stdin)
class '_io.TextIOWrapper'
 sys.stdin.readline()
a
'a\r\n'
 type(sys.stdout)
class '_io.TextIOWrapper'

Expected result:
There should be some form of text support, such as 
textstream(sys.stdin).readline(). Also type(sys.stdin) should not say something 
like TextIOWrapper. Same for sys.stdout.

--
components: IO
messages: 138356
nosy: r_mosaic
priority: normal
severity: normal
status: open
title: Need real TextIOWrapper for stdin/stdout
type: behavior
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12337
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1633941] for line in sys.stdin: doesn't notice EOF the first time

2009-08-04 Thread Fan Decheng

Changes by Fan Decheng fandech...@gmail.com:


--
nosy: +r_mosaic

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1633941
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6543] traceback presented in wrong encoding

2009-07-22 Thread Fan Decheng

New submission from Fan Decheng fandech...@gmail.com:

traceback information is wrongly encoded.
Steps to reproduce:
1. Use a version of Windows that supports CP936 (Simplified Chinese) as 
the default encoding.
2. Create a directory containing Chinese characters. Such as C:\测试
3. In the directory create a python file such as C:\测试\test.py
4. In the python file enter the following lines
import traceback
try:
aaa # create a non-existent name
except Exception as ex:
traceback.print_exc()
5. Run the program with this command line (remember to use full path to 
the test.py file):
C:\Python31\python.exe C:\测试\test.py
6. See the output.

Expected result:
There is correct output without encoding problems. Such as:

Traceback (most recent call last):
  File C:\测试\test.py, line 3, in module
NameError: name 'aaa' is not defined

Actual result:
UTF-8 encoded string is decoded using CP936 so the output is incorrect.

Traceback (most recent call last):
  File C:\娴嬭瘯\test.py, line 3, in module
NameError: name 'aaa' is not defined

Additional information:
In Python 3.0, such test would generate:
File decoding error, line 221, in main
In Python 3.1, the test generates the output mentioned in the repro 
steps.  As I tried traceback.format_exc(), it seems the original 
characters 测试 have become three Unicode characters when returned by 
format_exc().

--
components: Interpreter Core
messages: 90803
nosy: r_mosaic
severity: normal
status: open
title: traceback presented in wrong encoding
type: behavior
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6543
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5505] sys.stdin.read() doesn't return after first EOF on Windows

2009-03-25 Thread Fan Decheng

Fan Decheng fandech...@gmail.com added the comment:

Perhaps using just one read() is enough? I mean perhaps no loop is 
necessary?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5505
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5505] sys.stdin.read() doesn't return after first EOF on Windows

2009-03-18 Thread Fan Decheng

New submission from Fan Decheng fandech...@gmail.com:

Platform: Windows Vista x64
Python version: 3.0.1 x64

When I use sys.stdin.readlines(), it correctly ends when I enter ^Z 
(ctrl-Z) on the console (this is the EOF on the console). However when 
I call sys.stdin.read(), it doesn't end when ^Z is entered. It ends 
when I enter the second ^Z.

Repro steps:
1. Open python.
2. Type:
import sys
sys.stdin.read()
3. Type:
Hello
^Z
4. Note the above ^Z should be followed by a Return.
Result:
The function call doesn't end. If I enter another ^Z, it ends.
Expected result:
The function call ends.

--
components: Library (Lib)
messages: 83736
nosy: r_mosaic
severity: normal
status: open
title: sys.stdin.read() doesn't return after first EOF on Windows
type: behavior
versions: Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5505
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2938] Interactive help writes to the python install destination directory

2008-05-21 Thread Fan Decheng

New submission from Fan Decheng [EMAIL PROTECTED]:

Python 3.0a5 on Windows Vista SP1

I installed it to C:\Python30, and used NTFS permissions to protect the
files in the directory from being changed, also making the whole
directory read-only.  Thus, new files can't be created inside the directory.

Then:
1. Type help() in python.  Python goes into interactive help mode.
2. Type modules fnmatch in python.

Result:
Help quits with the following error:

IOError: [Errno 13] Permission denied:
'C:\\Python30\\lib\\lib2to3\\tests\\..\\G
rammar3.0.0.alpha.5.pickle'

For detailed error info please see the attached text file.

--
components: Library (Lib)
files: py3help_error.txt
messages: 67179
nosy: r_mosaic
severity: normal
status: open
title: Interactive help writes to the python install destination directory
type: crash
versions: Python 3.0
Added file: http://bugs.python.org/file10395/py3help_error.txt

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2938
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1193] os.system() encoding bug on Windows

2007-09-24 Thread Fan Decheng

Fan Decheng added the comment:

Steps to reproduce:

1. Use a Windows, with system default encoding to cp936 (Chinese PRC, or
Simplified Chinese) in Regional Options.
2. Open Python 3.0 (command line).
3. Type:
import os
import sys
os.system((echo  + sys.stdin.readline().rstrip(\n)).encode(cp936))
(in stdin type:)
我

Result:
The output from echo would be utf-8 mistakenly used as cp936:
鎴?

Expected result:
The echo command outputs 我.

Comments:
I guess os.system can recoding the string before sending the string out.
This may be done in the C part of Python. BTW, The os.popen() function 
is
correct.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1193
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1194] The reduce() documentation is lost in Python 3.0a1

2007-09-24 Thread Fan Decheng

New submission from Fan Decheng:

The reduce() documentation is lost in Python 3.0a1.
In the documentation, functools.reduce() points onto itself, so no
further explanation can be found.

--
components: Documentation
messages: 56103
nosy: r_mosaic
severity: minor
status: open
title: The reduce() documentation is lost in Python 3.0a1
type: rfe
versions: Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1194
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1193] os.system() encoding bug on Windows

2007-09-24 Thread Fan Decheng

Fan Decheng added the comment:

A note about reproducing: since Windows 2000 all language packs can be 
installed easily using the Regional Options in the Control Panel. Even 
on an English version of Windows, character set mappings and fonts of 
other languages can be installed.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1193
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1193] os.system() encoding bug on Windows

2007-09-23 Thread Fan Decheng

New submission from Fan Decheng:

Python 3.0 uses utf-8 encoding, but os.system() when running on Windows 
uses
the system default encoding, which may be cp936 or mbcs. They are
incompatible.

--
components: Library (Lib)
messages: 56101
nosy: r_mosaic
severity: major
status: open
title: os.system() encoding bug on Windows
type: behavior
versions: Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1193
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com