[IPython-dev] Dependency on pyreadline
Paul Moore
p.f.moore at gmail.com
Wed Nov 20 04:21:07 EST 2013
On 20 November 2013 08:25, Jörgen Stenarson <jorgen.stenarson at kroywen.se> wrote:
> Strictly speaking it is not imported into *every* python process. Only those
> that are interactive, for a script invoked by python script.py, pyreadline
> is not imported unless you import for instance pdb and use set_trace.
Did I not say interactive? Sorry, yes it's only interactive processes.
> If you add disable_readline(True) to the pyreadline.ini file pyreadline
> should not integrate itself into the readline hooks of python and you would
> see the standard behaviour where ctrl-D will generate ^D at the prompt
> instead of exiting the process.
Hmm, I wasn't even aware of pyreadline.ini - where is that documented?
Regardless, that is presumably a global file, so how is adding a line
to that file different from uninstalling pyreadline? (Both are easy
enough to do in a virtualenv, just inconvenient)
> I have not seen the infinite exception loop you see when using pyreadline
> master (what version of pyreadline and python are you using?)
>
> C:\python27> python
> Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import pip
>>>>
Python 3.3.2, whatever the latest released version is of Pyreadline
(2.0, see below), and pip development version (1.5pre) from git (pip
dev is important, see below).
>virtualenv foo
Using base prefix 'C:\\Apps\\Python33'
New python executable in foo\Scripts\python.exe
Installing setuptools, pip...done.
>foo\scripts\activate
>pip list
pip (1.5.dev1)
setuptools (1.3)
>pip install Pyreadline
Downloading/unpacking Pyreadline
Running setup.py
(path:C:\Work\personal\foo\build\Pyreadline\setup.py) egg_info for
package Pyreadline
package init file 'pyreadline\configuration\__init__.py' not found
(or not a regular file)
Not SVN Repository
Installing collected packages: Pyreadline
Running setup.py install for Pyreadline
package init file 'pyreadline\configuration\__init__.py' not found
(or not a regular file)
Not SVN Repository
Successfully installed Pyreadline
Cleaning up...
>pip list
pip (1.5.dev1)
pyreadline (2.0)
setuptools (1.3)
>python
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
Readline internal error
Traceback (most recent call last):
File "C:\Work\personal\foo\lib\site-packages\pyreadline\console\console.py",
line 768, in hook_wrapper_23
res = ensure_str(readline_hook(prompt))
It does not happen with the latest released pip:
>python -m pip install -I pip
Downloading/unpacking pip
Running setup.py (path:C:\Work\personal\foo\build\pip\setup.py)
egg_info for package pip
Not SVN Repository
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.rst' found under
directory 'docs\_build'
no previously-included directories found matching
'docs\_build\_sources'
Installing collected packages: pip
Found existing installation: pip 1.5.dev1
Uninstalling pip:
Successfully uninstalled pip
Running setup.py install for pip
Not SVN Repository
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.rst' found under
directory 'docs\_build'
no previously-included directories found matching
'docs\_build\_sources'
Installing pip-3.3-script.py script to
C:\Work\personal\foo\Scripts
Installing pip-3.3.exe script to C:\Work\personal\foo\Scripts
Installing pip-script.py script to C:\Work\personal\foo\Scripts
Installing pip.exe script to C:\Work\personal\foo\Scripts
Successfully installed pip
Cleaning up...
>pip list
pip (1.4.1)
pyreadline (2.0)
setuptools (1.3)
>python
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
>>>
My original thought was that it was a bad interaction with the
colorama package (included in pip develop) but I did my best to
comment out all uses of pip._vendor.colorama and I *think* I
succeeded, and I still got the traceback. There's a few too many
load-time and import-time hooks involved for me to be absolutely sure,
of course (and the Python process falls over, so I can't do any useful
postmortem debugging to see what's loaded...)
Paul
More information about the IPython-dev
mailing list