Issue1726

classification
Title: Interaction problem w/ emacs shells on windows
Type: Severity: normal
Components: Versions: Jython 2.7, Jython 2.5
Milestone:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: amak, fwierzbicki, gma, jeff.allen, pjenvey, zyasoft
Priority: normal Keywords: console

Created on 2011-03-30.15:58:41 by gma, last changed 2018-03-17.17:55:27 by jeff.allen.

Messages
msg6459 (view) Author: greg (gma) Date: 2011-03-30.15:58:41
On windows xp, start emacs and an emacs shell buffer (e.g., M-x shell, or M-x eshell). In that buffer run jython -i.

Jython 2.2.1 works fine. Commands typed at the prompt are evaluated and presented in the buffer.
Jython 2.5.x starts up, but does not respond to commands typed at the prompt.

What I'm really trying to do is get emacs' python.el, or python-mode.el to work, but this problem seems to be one of the root issues.

Could this be related to the recent issue 1723?
msg6476 (view) Author: Philip Jenvey (pjenvey) Date: 2011-04-10.22:26:37
If it's related to #1723 then I would think it's still actually "responding", you're just not seeing it respond. Try verifying whether it's responding or not, e.g. input code to write something to a tempfile and see if it works
msg6480 (view) Author: greg (gma) Date: 2011-04-12.21:43:22
Thanks for looking at this.  Was I supposed to respond direct to you?

I tried what you suggested, and found the following behavior.

I can get the jython interpreter to come up in an emacs buffer, but it  
does not print the prompt ( >>> ).
It will evaluate expressions and print results (no prompt) if I type  
them in the buffer.

The normal emacs process of evaluating buffers or regions of buffers  
does not seem to work at all -- I tried your file creation test.
But I think it's just because the prompt is not printed in the buffer.  
If I hand-type the prompt in the buffer, then emacs seems to send  
commands to it.

I re-tried my tests using jython2.2.1, and it works fine. Fails on  
2.5.2 and the other 2.5.x versions as well.

Perhaps the -i switch is not interpreted correctly?

I poked around in jython.jar, versions 2.2.1 and 2.5.2 and found these  
lines in 2.5.2 which may be causing the problem with the emacs buffer.

  PySystemState systemState = Py.getSystemState();
        // Decide if stdin is interactive
        if (!opts.fixInteractive || opts.interactive) {
            opts.interactive =  
((PyFile)Py.defaultSystemState.stdin).isatty();
            if (!opts.interactive) {
                systemState.ps1 = systemState.ps2 = Py.EmptyString;
            }
        }

On Apr 10, 2011, at 3:26 PM, Philip Jenvey wrote:

>
> Philip Jenvey <pjenvey@underboss.org> added the comment:
>
> If it's related to #1723 then I would think it's still actually  
> "responding", you're just not seeing it respond. Try verifying  
> whether it's responding or not, e.g. input code to write something  
> to a tempfile and see if it works
>
> ----------
> nosy: +pjenvey
>
> _______________________________________
> Jython tracker <report@bugs.jython.org>
> <http://bugs.jython.org/issue1726>
> _______________________________________
msg6485 (view) Author: greg (gma) Date: 2011-04-15.00:59:54
I have found how to get jython to work with emacs. Around line 158 in jython.java, if I set opts.interactive = false, but do not set systemState.ps1 or .ps2 to empty strings, then emacs interaction works.
msg6486 (view) Author: Philip Jenvey (pjenvey) Date: 2011-04-15.01:03:09
What version of Jython are you using, by the way? I know we've had a few fixes for interactive mode in probably all versions of 2.5.x. I thought we had finally got this right for 2.5.2, but maybe it's a regression.

I'd somewhat curious if 2.5.1 has the same issue
msg6487 (view) Author: greg (gma) Date: 2011-04-15.01:05:13
This comment did not seem to get into the issue report, so I'm sending  
it again.

greg <gmaxxx@comcast.net> added the comment:

I have found how to get jython to work with emacs. Around line 158 in  
jython.java, if I set opts.interactive = false, but do not set  
systemState.ps1 or .ps2 to empty strings, then emacs interaction works.
msg6488 (view) Author: greg (gma) Date: 2011-04-15.01:10:42
Everything worked in 2.2.x. Neither 2.5.1 nor 2.5.2 work, I have not  
tried to fix 2.5.1.

On Apr 14, 2011, at 6:03 PM, Philip Jenvey wrote:

>
> Philip Jenvey <pjenvey@underboss.org> added the comment:
>
> What version of Jython are you using, by the way? I know we've had a  
> few fixes for interactive mode in probably all versions of 2.5.x. I  
> thought we had finally got this right for 2.5.2, but maybe it's a  
> regression.
>
> I'd somewhat curious if 2.5.1 has the same issue
>
> ----------
> nosy: +zyasoft
>
> _______________________________________
> Jython tracker <report@bugs.jython.org>
> <http://bugs.jython.org/issue1726>
> _______________________________________
msg6489 (view) Author: Philip Jenvey (pjenvey) Date: 2011-04-15.01:12:15
Ok, knowing that it doesn't work in 2.5.1 nor 2.5.2 is helpful
msg6490 (view) Author: Philip Jenvey (pjenvey) Date: 2011-04-15.01:15:19
What does sys.stdout.isatty() return when run inside of Emacs?
msg6491 (view) Author: Philip Jenvey (pjenvey) Date: 2011-04-15.01:17:13
er, I'm guessing it returns False anyway. Since you're basically needing to force interactive mode with -i, the problem is that the force isn't working at all
msg6492 (view) Author: greg (gma) Date: 2011-04-15.01:17:32
Do you run emacs? Or would you like me to test some things in emacs? I  
don't really know java so I would need pretty specific info.

On Apr 14, 2011, at 6:12 PM, Philip Jenvey wrote:

>
> Philip Jenvey <pjenvey@underboss.org> added the comment:
>
> Ok, knowing that it doesn't work in 2.5.1 nor 2.5.2 is helpful
>
> _______________________________________
> Jython tracker <report@bugs.jython.org>
> <http://bugs.jython.org/issue1726>
> _______________________________________
msg6493 (view) Author: Philip Jenvey (pjenvey) Date: 2011-04-15.01:20:11
Just to double check, I'd like you to run the following inside jython within emacs:

import sys
print sys.stdout.isatty()

I do run Emacs on OS X, but I couldn't reproduce the problem on here. FYI the sys.stdout.isatty() returns True on OS X
msg6494 (view) Author: greg (gma) Date: 2011-04-15.01:22:38
There are two ways of interacting.
1) Start a shell (sort of like a bash shell, but it's an emacs thing)  
and run the jython command from there.
2) Start an inferior python buffer, evaluate expressions in your .py  
buffer, and the results get sent to the inferior buffer.

If I don't make the mod I suggested, neither work. If I do, they both  
work. isatty() was returning true in the second form of interaction.

On Apr 14, 2011, at 6:15 PM, Philip Jenvey wrote:

>
> Philip Jenvey <pjenvey@underboss.org> added the comment:
>
> What does sys.stdout.isatty() return when run inside of Emacs?
>
> _______________________________________
> Jython tracker <report@bugs.jython.org>
> <http://bugs.jython.org/issue1726>
> _______________________________________
msg6495 (view) Author: greg (gma) Date: 2011-04-15.01:27:39
Returning false in both modes of interaction.

On Apr 14, 2011, at 6:20 PM, Philip Jenvey wrote:

>
> Philip Jenvey <pjenvey@underboss.org> added the comment:
>
> Just to double check, I'd like you to run the following inside  
> jython within emacs:
>
> import sys
> print sys.stdout.isatty()
>
> I do run Emacs on OS X, but I couldn't reproduce the problem on  
> here. FYI the sys.stdout.isatty() returns True on OS X
>
> _______________________________________
> Jython tracker <report@bugs.jython.org>
> <http://bugs.jython.org/issue1726>
> _______________________________________
msg6496 (view) Author: greg (gma) Date: 2011-04-15.01:48:22
On osx, will jython2.5.2 be going into ports soon?
On Apr 14, 2011, at 6:27 PM, greg wrote:

>
> greg <gmaxxx@comcast.net> added the comment:
>
> Returning false in both modes of interaction.
>
> On Apr 14, 2011, at 6:20 PM, Philip Jenvey wrote:
>
>>
>> Philip Jenvey <pjenvey@underboss.org> added the comment:
>>
>> Just to double check, I'd like you to run the following inside
>> jython within emacs:
>>
>> import sys
>> print sys.stdout.isatty()
>>
>> I do run Emacs on OS X, but I couldn't reproduce the problem on
>> here. FYI the sys.stdout.isatty() returns True on OS X
>>
>> _______________________________________
>> Jython tracker <report@bugs.jython.org>
>> <http://bugs.jython.org/issue1726>
>> _______________________________________
>
> _______________________________________
> Jython tracker <report@bugs.jython.org>
> <http://bugs.jython.org/issue1726>
> _______________________________________
msg6498 (view) Author: greg (gma) Date: 2011-04-18.15:03:27
I need to get this fixed, and am willing to have a custom Jython until  
a solution is integrated into the official version.
What is the best way to correct this?

Thanks

On Apr 14, 2011, at 6:48 PM, greg wrote:

>
> greg <gmaxxx@comcast.net> added the comment:
>
> On osx, will jython2.5.2 be going into ports soon?
> On Apr 14, 2011, at 6:27 PM, greg wrote:
>
>>
>> greg <gmaxxx@comcast.net> added the comment:
>>
>> Returning false in both modes of interaction.
>>
>> On Apr 14, 2011, at 6:20 PM, Philip Jenvey wrote:
>>
>>>
>>> Philip Jenvey <pjenvey@underboss.org> added the comment:
>>>
>>> Just to double check, I'd like you to run the following inside
>>> jython within emacs:
>>>
>>> import sys
>>> print sys.stdout.isatty()
>>>
>>> I do run Emacs on OS X, but I couldn't reproduce the problem on
>>> here. FYI the sys.stdout.isatty() returns True on OS X
>>>
>>> _______________________________________
>>> Jython tracker <report@bugs.jython.org>
>>> <http://bugs.jython.org/issue1726>
>>> _______________________________________
>>
>> _______________________________________
>> Jython tracker <report@bugs.jython.org>
>> <http://bugs.jython.org/issue1726>
>> _______________________________________
>
> _______________________________________
> Jython tracker <report@bugs.jython.org>
> <http://bugs.jython.org/issue1726>
> _______________________________________
msg9904 (view) Author: Jim Baker (zyasoft) Date: 2015-04-19.23:04:59
Still present on Windows for Emacs, despite the recent changes in sys.ps1, sys.ps2 support and the new jython.exe launcher. Does not appear to be related to #1723

Works perfectly fine as far as I could tell on Unix-like systems like OS X 10.10
msg11827 (view) Author: Jeff Allen (jeff.allen) Date: 2018-03-17.17:55:27
I'll add that if I launch Jython 2.7.2a1 within Git-bash, I get no console prompts, but it echoes typing and responds. That may be the same problem, especially if this emacs is a mingw-thing. Note also #2305 as possibly related.
History
Date User Action Args
2018-03-17 17:55:27jeff.allensetnosy: + jeff.allen
messages: + msg11827
versions: + Jython 2.7
2015-04-19 23:04:59zyasoftsetmessages: + msg9904
2013-02-25 22:42:26amaksetkeywords: + console
2013-02-25 18:38:42fwierzbickisetpriority: normal
nosy: + fwierzbicki
versions: + Jython 2.5, - 2.5.1
2012-03-19 19:45:13amaksetnosy: + zyasoft
2012-03-19 19:44:22amaksetnosy: + amak, - zyasoft
2011-04-18 15:03:28gmasetmessages: + msg6498
2011-04-15 01:48:22gmasetmessages: + msg6496
2011-04-15 01:27:39gmasetmessages: + msg6495
2011-04-15 01:22:39gmasetmessages: + msg6494
2011-04-15 01:20:11pjenveysetmessages: + msg6493
2011-04-15 01:17:32gmasetmessages: + msg6492
2011-04-15 01:17:13pjenveysetmessages: + msg6491
2011-04-15 01:15:19pjenveysetmessages: + msg6490
2011-04-15 01:12:15pjenveysetmessages: + msg6489
2011-04-15 01:10:43gmasetmessages: + msg6488
2011-04-15 01:05:13gmasetmessages: + msg6487
2011-04-15 01:03:10pjenveysetnosy: + zyasoft
messages: + msg6486
2011-04-15 00:59:54gmasetmessages: + msg6485
2011-04-12 21:43:22gmasetmessages: + msg6480
2011-04-10 22:26:37pjenveysetnosy: + pjenvey
messages: + msg6476
2011-03-30 15:58:41gmacreate