all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: fgallina@gnu.org (Fabián Ezequiel Gallina)
To: Glenn Morris <rgm@gnu.org>, 17370@debbugs.gnu.org
Subject: bug#17370: 24.3.90; user cannot disable inferior python run from python-mode when file is visited
Date: Sun, 15 Jun 2014 14:12:32 -0300	[thread overview]
Message-ID: <87mwdef667.fsf@gnu.org> (raw)
In-Reply-To: <43k3a399xr.fsf@fencepost.gnu.org> (Glenn Morris's message of "Fri, 02 May 2014 16:56:16 -0400")

Glenn Morris <rgm@gnu.org> writes:

> Glenn Morris wrote:
>
>> (python-shell-internal-send-string "import sys;print ('\\n'.join(sys.path))")
>>
>> It is this that hangs (in python-shell-send-string-no-output AFAICS).
>> It also hangs in Emacs 24.3.
>>
>> emacs -Q -l python
>
> It seems that for me the hang is because I have customized my python
> prompt (sys.ps1 = 'py> ' in ~/.pythonrc.py).
>
> I have to set python-shell-prompt-regexp to match to avoid a hang as
> python.el thinks it needs to keep waiting for process output.
>
> Can python.el be made more robust in this regard?
>
> Otherwise there needs to be a big fat warning attached to
> python-shell-prompt-regexp.
>
>
>
>

We definitely can do better.

One way would be to set the prompt regexp dynamically using the values
of sys.ps1 and sys.ps2. But then we also need to be careful as those
values for ipython are a lie:

    $ ipython
    Python 2.7.6 (default, Mar 22 2014, 22:59:56)
    Type "copyright", "credits" or "license" for more information.

    IPython 1.2.1 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.

    In [1]: import sys

    In [2]: sys.ps1
    Out[2]: 'In : '

Perhaps the best way to go is a mixture of the current way and
dinamically expanding `python-shell-prompt-regexp` with sys.ps1 and
sys.ps2. I'll give it a try in the next few weeks and follow up once I
see how it goes.


    Fabián





  reply	other threads:[~2014-06-15 17:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29 12:11 bug#17370: 24.3.90; user cannot disable inferior python run from python-mode when file is visited Andy Moreton
2014-04-29 13:40 ` Glenn Morris
2014-04-29 14:12 ` Stefan Monnier
2014-04-29 15:06   ` Andy Moreton
2014-05-02 20:10     ` Glenn Morris
2014-05-02 20:56       ` Glenn Morris
2014-06-15 17:12         ` Fabián Ezequiel Gallina [this message]
2014-04-29 14:28 ` Andreas Röhler
2014-07-19 13:28 ` bug#17370: python-shell-internal-send-string can hang if you change your python prompt Fabián Ezequiel Gallina

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=87mwdef667.fsf@gnu.org \
    --to=fgallina@gnu.org \
    --cc=17370@debbugs.gnu.org \
    --cc=rgm@gnu.org \
    /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.