[IPython-dev] Pyreadline little issue.

Laurent Dufrechou laurent.dufrechou@gmail....
Sun Apr 20 16:52:13 CDT 2008


Hello there,

I've spent one hour or two tracking a stealthy bug.

Running a file .py that call wxipython works well under windows.

Running the same file but as .pyw (no console output) make the program
including wxipython crash.

 

I've traced the bug inside 10 files and finally I've found the bug. 

In pyreadline there is this line:

 

Pyreadline/unicode_helper.py:

 

try:

    pyreadline_codepage=sys.stdout.encoding

except AttributeError:        #This error occurs when pdb imports readline
and doctest has replaced 

                              #stdout with stdout collector

    pyreadline_codepage="ascii"   #assume ascii codepage

   

.

return text.decode(pyreadline_codepage, "replace")

 

The problem is that with myprog.py: sys.stdout.encoding = cpxxx (835 or
12??)

With myprog.pyw sys.stdout.encoding = None (!)

And the return crash.

 

Forcing 'ascii' solve the problem.

 

Must this be patched upstream in pyreadline? with:

try:

    pyreadline_codepage=sys.stdout.encoding

    if pyreadline_codepage is none:

                pyreadline_codepage="ascii"

except AttributeError:        #This error occurs when pdb imports readline
and doctest has replaced 

                              #stdout with stdout collector

    pyreadline_codepage="ascii"   #assume ascii codepage

 

or should I patch the behavior in my widget????

 

Cheers,

Laurent

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ipython.scipy.org/pipermail/ipython-dev/attachments/20080420/d1724cb7/attachment.html 


More information about the IPython-dev mailing list