[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25753: 25.2; Python mode shell interaction not working 100%

From: npostavs
Subject: bug#25753: 25.2; Python mode shell interaction not working 100%
Date: Tue, 28 Feb 2017 09:07:02 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

address@hidden (Charles A. Roelli) writes:

> using `python-shell-interpreter' and `cat | python $'.  Python exited
> immediately with code 126, so I guess this solution does not work here.
> But I can't claim to understand any issues having to do with TTYs/"dumb
> terminals", so maybe I am missing something.

The equivalent for python.el would be approximately

(defun my-python-shell-calculate-command (&rest _)
  "sh -c \"cat | python -i\"")
(advice-add 'python-shell-calculate-command :override

But this breaks native completion and prompt detection, due to IO
buffering I think.

>>>  So it would seem that `sudo easy_install
>>> gnureadline' is the right thing to run.  However that still does not fix
>>> the issue because python2.7/lib-dynload/ comes before
>>> python2.7/site-packages/ (where `gnureadline' is installed) in Python's
>>> $PATH equivalent, `sys.path'.  The solution, then, is to reorder the
>>> path somehow or get `readline.so' out of the way (maybe by renaming it
>>> -- cleaner suggestions welcome).
>> I guess renaming should have the least amount of side-effects.
> Great.  This is what works for me:
> cd /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
> mv readline.so readline.so.bak
> Hopefully we can add into emacs-25 a comment about this situation,
> advising Mac OS X users to install `gnureadline' with `easy_install
> gnureadline', then renaming `readline.so' to something not ending in
> `.so', if the native completion does not work immediately.

Does this look okay?

--- i/etc/PROBLEMS
+++ w/etc/PROBLEMS
@@ -463,8 +463,25 @@ problem by adding this to your .cshrc file:
         unset edit
         stty -icrnl -onlcr -echo susp ^Z
+*** In Inferior Python mode, input is echoed and native completion doesn't 
+This happens when python uses a libedit based readline module, which
+is the default on macOS.  This can be worked around by installing a
+GNU readline based module instead, for example, using setuptools
+    sudo easy_install gnureadline
+And then rename the system's readline so that it won't be loaded:
+    cd 
+    mv readline.so readline.so.bak
+See <https://pypi.python.org/pypi/gnureadline> for more details on
 *** Emacs startup on GNU/Linux systems (and possibly other systems) is slow.
 This can happen if the system is misconfigured and Emacs can't get the
 full qualified domain name, FQDN.  You should have your FQDN in the

reply via email to

[Prev in Thread] Current Thread [Next in Thread]