[IPython-user] [IPython-dev] Win32 - call for pyreadline testing
Jörgen Stenarson
jorgen.stenarson@bostream...
Mon Apr 16 13:05:18 CDT 2007
Tom thanks for the report. I have just comitted a patch I think works
around this, please let me know if it fixes your problem. The problem is
that doctest replaces sys.stdout with a dummy object before it imports
pdb which imports readline, this dummy object does not preserve the
encoding property of the original stdout. Since doctest is in the
process of being imported I don't see how we can obtain the original
stdout and set a proper encoding so we assume ascii. If you really need
a correctly set output encoding import readline before doctest.
/Jörgen
Tom Denniston skrev:
> I don't know if anyone has reported it but I am finding that
> pyreadline 1.4 doesn't seem to play nice with doctest.
>
> I was getting this error:
>
> Traceback (most recent call last):
> File "c:\work\src\runTests.py", line 12, in ?
> failures, tests = _test(sys.argv[1])
> File "c:\work\src\runTests.py", line 9, in _test
> return doctest.testmod(sys.modules[modname])
> File "c:\local\python24\lib\site-packages\setuptools-0.7a1dev_r53614-py2.4.egg\doctest.py",
> line 1853, in testmod
> runner.run(test)
> File "c:\local\python24\lib\site-packages\setuptools-0.7a1dev_r53614-py2.4.egg\doctest.py",
> line 1377, in run
> self.debugger = _OutputRedirectingPdb(save_stdout)
> File "c:\local\python24\lib\site-packages\setuptools-0.7a1dev_r53614-py2.4.egg\doctest.py",
> line 353, in __init__
> pdb.Pdb.__init__(self)
> File "C:\local\Python24\lib\pdb.py", line 64, in __init__
> import readline
> File "C:\local\Python24\Lib\site-packages\readline.py", line 5, in ?
> from pyreadline import *
> File "C:\local\Python24\Lib\site-packages\pyreadline\__init__.py",
> line 10, in ?
> from rlmain import *
> File "C:\local\Python24\Lib\site-packages\pyreadline\rlmain.py", line 13, in ?
> import clipboard,logger,console
> File "C:\local\Python24\Lib\site-packages\pyreadline\console\__init__.py",
> line 14, in ?
> from console import *
> File "C:\local\Python24\Lib\site-packages\pyreadline\console\console.py",
> line 118, in ?
> consolecodepage=sys.stdout.encoding
> AttributeError: _SpoofOut instance has no attribute 'encoding'
>
> I deleted the pyreadline 1.4 installation and it went away. I
> installed 1.3 again and still have no problem. I was kind of suprised
> that it would affect doctest but it looks like pyreadline replaces the
> normal readline that pdb uses and doctest in turn imports pdb to
> redirect its output to the screen properly. Has anyone else seen
> anything like this?
>
>
>
>
> On 4/11/07, aldarion <erendisaldarion@gmail.com> wrote:
>> I have tested it already:)
>> after fix the space problem(pyreadline1.4.2), ipython works and don't return
>> the
>> exceptions.AttributeError when run foo.py
>> however, there is still the exceptions.IndexError when
>> C:\>C:\Python25\python.exe C:\Python25\scripts\ipython "\Documents and
>> Settings\cbcoasis\Desktop\test.py"
>>
>> On 4/12/07, Fernando Perez <fperez.net@gmail.com> wrote:
>>> On 4/11/07, aldarion <erendisaldarion@gmail.com > wrote:
>>>> It looks the definition line of two function(clear_history of rlmain and
>>>> history)
>>>> miss a space(it should be four and now is three, and the function body
>> lack
>>>> one space too)
>>>> and the function (clear_history) maybe responsible for the '
>>>> exceptions.AttributeError',
>>> Ugh, sorry. I copy/pasted from the mail client and didn't notice it
>>> went in missing a space.
>>>
>>> 1.4.2 is up:
>>>
>>> http://ipython.scipy.org/dist/pyreadline-1.4.2.win32.exe
>>>
>> http://ipython.scipy.org/dist/pyreadline-1.4.2.dev_r2238-py2.4.egg
>>>> there is still the IndexError error as Chris Calloway'said, no clue here
>>> Let me know if those help in any way, and see if you can send me a
>>> fuller traceback on that problem. I'm 100% blind here since I can't
>>> run any of this code at all...
>>>
>>> Thanks again for the help and patience!
>>>
>>> Cheers,
>>>
>>> f
>>>
>>
>> _______________________________________________
>> IPython-user mailing list
>> IPython-user@scipy.org
>> http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
>>
>>
> _______________________________________________
> IPython-user mailing list
> IPython-user@scipy.org
> http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
>
More information about the IPython-user
mailing list