473,851 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Win32 python: odd behavior when run via ssh

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
Feb 1 '08 #1
8 1958
Grant Edwards <gr****@visi.co mwrote:
>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] rr****@csclub.u waterloo.ca
-()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
db //
Feb 2 '08 #2
En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge
<rr****@caffein e.csclub.uwater loo.caescribió:
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

Feb 2 '08 #3
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
Feb 2 '08 #4
On 2008-02-02, Gabriel Genellina <ga*******@yaho o.com.arwrote:
En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge
<rr****@caffei ne.csclub.uwate rloo.caescribió :
>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?
Feb 2 '08 #5
Gabriel Genellina wrote:
En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge
<rr****@caffein e.csclub.uwater loo.caescribió:
>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.holdenweb.com/
Feb 2 '08 #6
Gabriel Genellina wrote:
En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge
<rr****@caffein e.csclub.uwater loo.caescribió:
>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.holdenweb.com/

Feb 2 '08 #7
En Sat, 02 Feb 2008 01:40:50 -0200, Steve Holden <st***@holdenwe b.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

Feb 2 '08 #8
* Gabriel Genellina (Fri, 01 Feb 2008 23:13:27 -0200)
En Fri, 01 Feb 2008 22:31:06 -0200, Ross Ridge
<rr****@caffein e.csclub.uwater loo.caescribió :
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
Feb 2 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1751
by: Prabhu Ramachandran | last post by:
Hi, I noticed peculiar behavior under Python-2.3.4 under Win32. When I run something like this: f = open('t.txt', 'wb') f.write('1\012'+'2\012'+'3\012') f.close() f = open('t.txt', 'r') f.readline()
1
2202
by: Brian Beck | last post by:
As far as I can tell, both maintainers of the Windows builds of Python-LDAP haven't updated in about a year. This doesn't exactly make the builds ancient or obsolete, but it would be nice to start fresh with the latest version. I've tried without success in building it myself. The hardest part is simply that Python-LDAP is dependent on at LEAST two other projects -- OpenLDAP and Cyrus SASL. This increases the difficulty three-fold. ...
7
4209
by: Robert | last post by:
Hello, I'm using Pythonwin and py2.3 (py2.4). I did not come clear with this: I want to use win32-fuctions like win32ui.MessageBox, listctrl.InsertItem ..... to get unicode strings on the screen - best results according to the platform/language settings (mainly XP Home, W2K, ...). Also unicode strings should be displayed as nice as possible at the console with normal print-s to stdout (on varying platforms, different
3
1962
by: James Stroud | last post by:
Hello All, I am helping someone write a python script to run their DOS application through an SSH terminal. It seems that this program wants to access a DOS shell and send output there. If running remotely, this causes a problem because it locks up the program. The program seems (to me) to be looking for some non-existant DOS shell to send its output to. How might I emulate this shell (or whatever it is) with python? I have tried...
1
2157
by: Srijit Kumar Bhadra | last post by:
I have browsed the following links 1) http://peak.telecommunity.com/DevCenter/EasyInstall 2) When Python *Eggs* better than Python *distutils*?? What's Eggs? (http://tinyurl.com/m8dyd) But I am still not clear what to do with an .egg file. For example, if I have a basic Python installation (http://www.python.org/ftp/python/2.4.3/python-2.4.3.msi) what should I do with a typical .egg file (e.g....
2
1926
by: Pierre Rouleau | last post by:
Hi all, When using Python 2.4.x on a Win32 box, marshal.loads(marshal.dumps(1e66666)) returns 1.0 instead of infinity as it should and does under Python 2.5 (also running on Win32 ). This problem was reported in another thread here by Peter Hansen http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/5c2b4b2a88c8df4/f216739705c9304f?lnk=gst&q=simplejson&rnum=5#f216739705c9304f Is this considered an important enough...
0
11020
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10356
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9506
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5736
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5934
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4549
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4143
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.