[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Win32 python: odd behavior when run via ssh

Grant Edwards

2/1/2008 9:47:00 PM

When I ssh into a windows machine (running Cygwin sshd), I can
invoke python at the shell prompt (you have to use -i option
and I don't really understand why).

Once it's started there are couple rather odd behaviors:

1) readline support doesn't work.

2) you have call sys.exit() to exit (neither ctrl-D or ctrl-Z
work)

Number 2) I don't really care about, but 1) is pretty annoying.

--
Grant Edwards grante Yow! I was making donuts
at and now I'm on a bus!
visi.com
9 Answers

Ross Ridge

2/2/2008 12:31:00 AM

0

Grant Edwards <grante@visi.com> wrote:
>When I ssh into a windows machine (running Cygwin sshd), I can
>invoke python at the shell prompt (you have to use -i option
>and I don't really understand why).
>
>Once it's started there are couple rather odd behaviors:
>
> 1) readline support doesn't work.

My guess is either that Cygwin version of Python you invoked doesn't
think that stdin/stdout is attached to a tty (ie. the pseudo-terminal
that sshd should create), or you're using official Win32 "native" Python
distribution Python and it doesn't think stdin/stdout is attached to
a console.

If you're using the Cygwin version of Python than it's probably bug.
If you're using the offficial Win32 port of Python than you probably
want to use the Cygwin version because Win32 version doesn't support
readline anyways.

Ross Ridge

--
l/ // Ross Ridge -- The Great HTMU
[oo][oo] rridge@csclub.uwaterloo.ca
-()-/()/ http://www.csclub.uwaterloo.c...
db //

Grant Edwards

2/2/2008 12:52:00 AM

0

On 2008-02-02, Ross Ridge <rridge@caffeine.csclub.uwaterloo.ca> wrote:

>>When I ssh into a windows machine (running Cygwin sshd), I can
>>invoke python at the shell prompt (you have to use -i option
>>and I don't really understand why).
>>
>>Once it's started there are couple rather odd behaviors:
>>
>> 1) readline support doesn't work.
>
> My guess is either that Cygwin version of Python you invoked doesn't
> think that stdin/stdout is attached to a tty (ie. the pseudo-terminal
> that sshd should create), or you're using official Win32 "native" Python
> distribution Python and it doesn't think stdin/stdout is attached to
> a console.

The latter. I guess I forgot to say I was running the normal
Win32 python.

> If you're using the Cygwin version of Python than it's
> probably bug. If you're using the offficial Win32 port of
> Python than you probably want to use the Cygwin version
> because Win32 version doesn't support readline anyways.

That's odd, because readline seems to work fine in a Windows
console (recalling previous lines and line editing).

--
Grant Edwards grante Yow! Do you guys know we
at just passed thru a BLACK
visi.com HOLE in space?

Gabriel Genellina

2/2/2008 1:13:00 AM

0

En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge
<rridge@caffeine.csclub.uwaterloo.ca> escribió:

> If you're using the offficial Win32 port of Python than you probably
> want to use the Cygwin version because Win32 version doesn't support
> readline anyways.

I don't understand the comment. Most of the readline functionality is
already present on Windows XP (command history, up/down arrows, edit entry
with left/right arrows, choose entry from list, autocompletion, separate
buffers for each program...). On earlier versions you only had to load
doskey.exe (or doskey.com) at startup, and the command had existed from
jurasic age... That Python on Windows doesn't support specifically the GNU
readline utility is irrelevant.

--
Gabriel Genellina

Martin v. Loewis

2/2/2008 1:21:00 AM

0

> That's odd, because readline seems to work fine in a Windows
> console (recalling previous lines and line editing).

That's an illusion. The Windows version of Python does not
support or use GNU readline at all. What you see is a feature
of the console window.

Regards,
Martin

Grant Edwards

2/2/2008 1:43:00 AM

0

On 2008-02-02, Gabriel Genellina <gagsl-py2@yahoo.com.ar> wrote:
> En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge
><rridge@caffeine.csclub.uwaterloo.ca> escribió:
>
>> If you're using the offficial Win32 port of Python than you
>> probably want to use the Cygwin version because Win32 version
>> doesn't support readline anyways.
>
> I don't understand the comment. Most of the readline
> functionality is already present on Windows XP (command
> history, up/down arrows, edit entry with left/right arrows,
> choose entry from list, autocompletion, separate buffers for
> each program...). On earlier versions you only had to load
> doskey.exe (or doskey.com) at startup, and the command had
> existed from jurasic age... That Python on Windows doesn't
> support specifically the GNU readline utility is irrelevant.

Until you try to run Python inside something other than the
Windows console.

--
Grant Edwards grante Yow! Is something VIOLENT
at going to happen to a
visi.com GARBAGE CAN?

Steve Holden

2/2/2008 3:41:00 AM

0

Gabriel Genellina wrote:
> En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge
> <rridge@caffeine.csclub.uwaterloo.ca> escribió:
>
>> If you're using the offficial Win32 port of Python than you probably
>> want to use the Cygwin version because Win32 version doesn't support
>> readline anyways.
>
> I don't understand the comment. Most of the readline functionality is
> already present on Windows XP (command history, up/down arrows, edit entry
> with left/right arrows, choose entry from list, autocompletion, separate
> buffers for each program...). On earlier versions you only had to load
> doskey.exe (or doskey.com) at startup, and the command had existed from
> jurasic age... That Python on Windows doesn't support specifically the GNU
> readline utility is irrelevant.
>
Until you try to do something like a reverse history search using
CTRL/R, for example, and then the limitations of the XP command window
start to become obvious.

But it's somewhat perverse to try to run standard Windows binaries under
Cygwin. Though it is a fine environment you get into real trouble with
things like filename completion, since the shell completes names in the
Cygwin filename space, and the Windows binaries can't make head nor tail
of something like /c/Python25/python.exe.

That may well be why the Python interpreter isn't recognizing the sshd's
pty as a terminal, too.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.hold...

Steve Holden

2/2/2008 3:41:00 AM

0

Gabriel Genellina wrote:
> En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge
> <rridge@caffeine.csclub.uwaterloo.ca> escribió:
>
>> If you're using the offficial Win32 port of Python than you probably
>> want to use the Cygwin version because Win32 version doesn't support
>> readline anyways.
>
> I don't understand the comment. Most of the readline functionality is
> already present on Windows XP (command history, up/down arrows, edit entry
> with left/right arrows, choose entry from list, autocompletion, separate
> buffers for each program...). On earlier versions you only had to load
> doskey.exe (or doskey.com) at startup, and the command had existed from
> jurasic age... That Python on Windows doesn't support specifically the GNU
> readline utility is irrelevant.
>
Until you try to do something like a reverse history search using
CTRL/R, for example, and then the limitations of the XP command window
start to become obvious.

But it's somewhat perverse to try to run standard Windows binaries under
Cygwin. Though it is a fine environment you get into real trouble with
things like filename completion, since the shell completes names in the
Cygwin filename space, and the Windows binaries can't make head nor tail
of something like /c/Python25/python.exe.

That may well be why the Python interpreter isn't recognizing the sshd's
pty as a terminal, too.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.hold...

Gabriel Genellina

2/2/2008 6:34:00 AM

0

En Sat, 02 Feb 2008 01:40:50 -0200, Steve Holden <steve@holdenweb.com>
escribi�:
> Gabriel Genellina wrote:

>> I don't understand the comment. Most of the readline functionality is
>> already present on Windows XP (command history, up/down arrows, edit
>> [...]
> Until you try to do something like a reverse history search using
> CTRL/R, for example, and then the limitations of the XP command window
> start to become obvious.

Just type a few characters, press F8 and see what happens.

(readline has a lot of features, and the Windows history editing
capabilities are somewhat limited, but it's amazing you choose exactly one
feature that IS implemented!)

--
Gabriel Genellina

Thorsten Kampe

2/2/2008 3:38:00 PM

0

* Gabriel Genellina (Fri, 01 Feb 2008 23:13:27 -0200)
> En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge
> <rridge@caffeine.csclub.uwaterloo.ca> escribió:
> > If you're using the offficial Win32 port of Python than you
> > probably want to use the Cygwin version because Win32 version
> > doesn't support readline anyways.
>
> I don't understand the comment. Most of the readline functionality
> is already present on Windows XP (command history, up/down arrows,
> edit entry with left/right arrows, choose entry from list,
> autocompletion, separate buffers for each program...).

Not at all readline compares to Cmd editing like Python to BASIC. If
in doubt, read the readline manpage.

Thorsten