all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: charles@aurox.ch (Charles A. Roelli)
To: npostavs@users.sourceforge.net
Cc: 25753@debbugs.gnu.org
Subject: bug#25753: 25.2; Python mode shell interaction not working 100%
Date: Sat, 25 Feb 2017 23:28:12 +0100	[thread overview]
Message-ID: <m2efylsy6b.fsf@aurox.ch> (raw)
In-Reply-To: <877f4efifx.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Sat, 25 Feb 2017 09:34:10 -0500")

On Sat, Feb 25 2017 at 09:34:10 am, npostavs@users.sourceforge.net wrote:

> charles@aurox.ch (Charles A. Roelli) writes:
>
>> Could you please evaluate these forms with a running instance of
>> Python in Emacs?  My output follows each form.  It seems like the Mac
>> version of Python echoes the last command sent, and maybe python.el
>> does not expect this?
>
> Yes, I was going to ask if you also get this echoing for commands typed
> in at the prompt or is it just the support functions?  

Seems to be everywhere.

> Possibly setting `comint-process-echoes' could help, though I don't
> understand why there is echoing in the first place.

Thanks for the pointer to that variable.  I ran this:

   (add-hook 'inferior-python-mode-hook (lambda () (setq comint-process-echoes t)))

and the commands at the prompt stopped echoing, but the support
functions still echoed.  So it looks like the problem has to be fixed on
the readline/libedit side of Python.

> Here is what I get:
>
>     (python-shell-send-string-no-output "import os\nimport sys") ;=> ""
>     (python-shell-send-string-no-output "import os; import sys") ;=> ""
>     (python-ffap-module-path "os") ;=> "/usr/lib/python3.6/os.py"

Thanks.  I managed to fix my setup to give equivalent results (see below).

> By the way, it was reported[1] that using "homebrew" python avoids these
> issues, apparently that build uses GNU readline instead of libedit[2].
>
> [1]: https://github.com/jorgenschaefer/elpy/issues/887#issuecomment-282215656
> [2]: https://github.com/jorgenschaefer/elpy/issues/887#issuecomment-282332143

Thanks for setting me on this trail.  It turns out there's a package you
can install via `easy_install' (part of Python's `setuptools') called
`gnureadline' [1] (formerly called just `readline') which is supposed to
shadow python2.7/lib-dynload/'s `readline.so' with a relatively
up-to-date statically linked GNU replacement (for those of us with a
wacky `libedit'-ized version).  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 haven't tested that yet, but it
should work as expected.

At the moment I've been running M-x run-python from the
python2.7/site-packages/ folder where `readline.py' is stored, since
Python adds the path of the current directory to the front of
`sys.path'.  That means `readline.py' gets picked from there, which is
convenient, if not a little surprising at first.  With that done, the
forms I posted previously evaluate as expected, without the code
echoing.  Eldoc also works fine.  Maybe we can add a notice about this
somewhere in python.el in emacs-25.  I'm not sure yet about the best way
to handle the path ordering issue between `readline.so' and
`gnureadline'.

[1] https://pypi.python.org/pypi/gnureadline





  reply	other threads:[~2017-02-25 22:28 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 16:07 bug#25753: 25.2; Python mode shell interaction not working 100% Charles A. Roelli
2017-02-16 17:54 ` Eli Zaretskii
2017-02-18 17:44   ` npostavs
2017-02-19 15:14     ` Live System User
2017-02-19 15:26       ` Noam Postavsky
2017-02-19 19:39         ` Live System User
2017-02-19 20:00           ` Noam Postavsky
2017-02-19 21:32             ` Live System User
2017-02-20  1:30               ` npostavs
2017-02-20 22:34                 ` Live System User
2017-02-21  1:46                   ` npostavs
2017-02-21  3:32                     ` Live System User
2017-02-21 13:35                       ` npostavs
2017-02-21 23:17                         ` Live System User
2017-02-22  1:40     ` npostavs
2017-02-22 19:43       ` Charles A. Roelli
2017-02-23 14:20         ` npostavs
2017-02-24 10:19           ` Charles A. Roelli
2017-02-25 14:11           ` Charles A. Roelli
2017-02-25 14:34             ` npostavs
2017-02-25 22:28               ` Charles A. Roelli [this message]
2017-02-27  2:14                 ` npostavs
2017-02-28 10:34                   ` Charles A. Roelli
2017-02-28 14:07                     ` npostavs
2017-02-28 15:56                       ` Eli Zaretskii
2017-03-01 23:00                         ` npostavs
2021-10-03 16:03 ` Carlos Pita
2021-10-03 16:31   ` Carlos Pita
2021-10-03 23:35     ` Carlos Pita
2021-10-03 23:55       ` Carlos Pita
2021-10-04  0:46         ` Carlos Pita
2021-10-04 15:05           ` Carlos Pita
2021-10-04  8:21         ` Augusto Stoffel
2021-10-04 15:31           ` Carlos Pita
2021-10-04 15:47             ` Augusto Stoffel
2023-08-11 17:55 ` bug#25753: 29.1; " Peter Mao
2023-08-25  5:32   ` Peter Mao
2023-08-25  6:31     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2efylsy6b.fsf@aurox.ch \
    --to=charles@aurox.ch \
    --cc=25753@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.