bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#17370: 24.3.90; user cannot disable inferior python run from python-


From: Fabián Ezequiel Gallina
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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 via email to

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