Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Yes, this is a python question, and a serious one at that (moving to Win XP)

794 views
Skip to first unread message

Kenneth McDonald

unread,
Oct 13, 2005, 4:30:58 PM10/13/05
to pytho...@python.org
For unfortunate reasons, I'm considering switching back to Win XP
(from OS X) as my "main" system. Windows has so many annoyances that
I can only compare it to driving in the Bay Area at rush hour (OS X
is like driving in Portland at rush hour--not as bad, but getting
there), but there are really only a couple of things that are really,
absolutely preventing me from making the switch. Number one is the
lack of a decent command line and command-line environment, and I'm
wondering (hoping) if perhaps someone has written a "Python shell"--
something that will look like a regular shell, let users type in
commands, maybe have some of the nice features of bash etc. like tab
completion, etc, and will then execute an underlying python script
when the command is entered. I'm not thinking of IDLE, but something
that is really aimed more at being a system terminal, not a Python-
specific terminal.

Yes, I know that Cygwin is out there, but last I looked, they still
went through the Win command-line window, which imposes a lot of
restrictions.

More generally, has anyone written any python programs to administer
various Win settings for which one must otherwise delve deep into
mazes of twisty little dialogs, all alike? Or to help out with other
annoyances? I know there are a lot of general utilities, but if
they're in Python, I can also use them as a starting base for my own
needs.

Finally, a significant incentive in doing this is that I could avoid
a lot of installation hassle, since virtually everything has at least
a decent installation package for Win. (I'd hoped this would happen
for OS X, but it never has). Can anyone think of important python-
related packages (release level, not cutting edge alphas) for which
this might not be the case?

Many thanks,
Ken

Jeremy Jones

unread,
Oct 13, 2005, 4:39:12 PM10/13/05
to pytho...@python.org
Kenneth McDonald wrote:

>For unfortunate reasons, I'm considering switching back to Win XP
>(from OS X) as my "main" system. Windows has so many annoyances that
>I can only compare it to driving in the Bay Area at rush hour (OS X
>is like driving in Portland at rush hour--not as bad, but getting
>there), but there are really only a couple of things that are really,
>absolutely preventing me from making the switch. Number one is the
>lack of a decent command line and command-line environment, and I'm
>wondering (hoping) if perhaps someone has written a "Python shell"--
>something that will look like a regular shell, let users type in
>commands, maybe have some of the nice features of bash etc. like tab
>completion, etc, and will then execute an underlying python script
>when the command is entered. I'm not thinking of IDLE, but something
>that is really aimed more at being a system terminal, not a Python-
>specific terminal.
>
>

ipython -p pysh

IPython rocks as a Python shell. I use zsh mostly, but IPython's pysh
looks pretty good. I hate to help you get back on Windows, though :-)


- jmj

Claudio Grondi

unread,
Oct 13, 2005, 7:11:59 PM10/13/05
to
What I can point you to is not Python, but embedding it in Python
is a question of executing one line of Python code triggering its
execution.
I think you will be fascinated by its features and ease of use and
how well it is suited to fit into your needs:
http://www.autoitscript.com/autoit3/index.php
With it you will start to see, that forcing to obey to Windows way
of doing things has not only bad sides.

Is there something similar for another OSs-es (especially Linux)?

Claudio

"Kenneth McDonald" <kenneth.m...@sbcglobal.net> schrieb im Newsbeitrag
news:mailman.2030.112923...@python.org...

John J. Lee

unread,
Oct 13, 2005, 7:47:10 PM10/13/05
to pytho...@python.org
Kenneth McDonald <kenneth.m...@sbcglobal.net> writes:
[...]

> absolutely preventing me from making the switch. Number one is the
> lack of a decent command line and command-line environment, and I'm
> wondering (hoping) if perhaps someone has written a "Python shell"--
> something that will look like a regular shell, let users type in
> commands, maybe have some of the nice features of bash etc. like tab
> completion, etc, and will then execute an underlying python script
> when the command is entered. I'm not thinking of IDLE, but something
> that is really aimed more at being a system terminal, not a Python-
> specific terminal.
[...]

cmd.exe can be made bearable. I just got a new machine, so I'll have
to do this myself in the next few days...

0. Make a shortcut to cmd.exe, stick it somewhere get-at-able,
eg. quick launch toolbar

1. Somewhere under the menu reachable from the little icon in the
top-left corner you can set the default directory when cmd is
launched, plus there's some way to set up env vars (eg. PYTHONPATH)

2. Fiddle with buffers to make them sensible sizes (that menu again).

3. Adjust colours to taste (menu again).

4. There's a registry key for tab completion somewhere...

5. Make sure .py is associated with the Python you want


Also see IPython, which does do shell-ish things as well as python-ish
things.

John

Trent Mick

unread,
Oct 13, 2005, 8:04:15 PM10/13/05
to John J. Lee, pytho...@python.org
[John J. Lee wrote]

> 4. There's a registry key for tab completion somewhere...

Search for "CompletionChar" and change it to 9.

http://www.microsoft.com/resources/documentation/Windows/2000/server/reskit/en-us/Default.asp?url=/resources/documentation/Windows/2000/server/reskit/en-us/regentry/34995.asp


Cheers,
Trent

--
Trent Mick
Tre...@ActiveState.com

Christian Stapfer

unread,
Oct 14, 2005, 12:32:43 AM10/14/05
to
"John J. Lee" <j...@pobox.com> wrote in message
news:mailman.2039.112924...@python.org...

> Kenneth McDonald <kenneth.m...@sbcglobal.net> writes:
> [...]
>> absolutely preventing me from making the switch. Number one is the
>> lack of a decent command line and command-line environment, and I'm
>> wondering (hoping) if perhaps someone has written a "Python shell"--
>> something that will look like a regular shell, let users type in
>> commands, maybe have some of the nice features of bash etc. like tab
>> completion, etc, and will then execute an underlying python script
>> when the command is entered. I'm not thinking of IDLE, but something
>> that is really aimed more at being a system terminal, not a Python-
>> specific terminal.
> [...]
>
> cmd.exe can be made bearable. I just got a new machine, so I'll have
> to do this myself in the next few days...
>
> 0. Make a shortcut to cmd.exe, stick it somewhere get-at-able,
> eg. quick launch toolbar

0.0. ... and add an item to your SendTo folder that allows
you to have Windows Explorer open a terminal window with its
current directory set to the currently displayed folder
(= "Open terminal here").

Regards,
Christian


Christophe

unread,
Oct 14, 2005, 6:37:25 AM10/14/05
to
Kenneth McDonald a écrit :

Last time I checked, you could install a native win32gui version of rxvt
with cygwin. This would give you a better terminal window than that
crappy thing you get in XP.

Peter Hansen

unread,
Oct 14, 2005, 6:43:12 AM10/14/05
to
Christian Stapfer wrote:
> 0.0. ... and add an item to your SendTo folder that allows
> you to have Windows Explorer open a terminal window with its
> current directory set to the currently displayed folder
> (= "Open terminal here").

Or install the "Command Prompt Here" gadget that MS produces, which has
a massive installer and a click-through license thing and everything,
just to open a freakin' prompt at a given directory. I'm continually
amazed by how these little bits of knowledge (like the one Christian
provides above and which I never knew before) have to be disseminated
through the grass roots, so to speak. Definitely like the MS world is
not set up for real developers easily to be productive.

-Peter

Scott David Daniels

unread,
Oct 14, 2005, 12:32:49 PM10/14/05
to
Christian Stapfer wrote:
> "John J. Lee" <j...@pobox.com> wrote in message
> news:mailman.2039.112924...@python.org...
>
>>cmd.exe can be made bearable....

>>
>>0. Make a shortcut to cmd.exe, stick it somewhere get-at-able,
>> eg. quick launch toolbar
I put it on my desktop. Once having made it, fiddle with
"Start in" to be your favorite python code directory (that is
why I usually have several), and append a space and /D /X /F:ON
to the "Target" line.

You can see the options to cmd by typing "HELP CMD" or
"HELP CMD>>CMD_DOC", or by looking up the "Windows Command Reference"
and reading about the "cmd" command.

I find a bunch of text in a file easier to read than Microsoft's
help facility (it comes in tiny bites w/o clear navigation to my
tastes). At one time, more info was in the help command text than
was available through the help facility, but they've gotten closer.
I'm not sure whether the same info is in both; better to review both.

Here's a cute recipe for getting the help command text (works only
for Python 24).
From Python 2.4 (either in Idle or from a command line):

import subprocess as subp

p = subp.Popen("cmd.exe /X/D/F:ON", stdin=subp.PIPE,
stdout=subp.PIPE, stderr=subp.STDOUT)
flag = "(@@@@@@}"
print >>p.stdin, "PROMPT", flag
print >>p.stdin, "HELP"
print >>p.stdin, "EXIT"
text = p.stdout.read()
p.wait()
helptext = text[text.index(flag + 'HELP') + len(flag) + 4 :
text.index(flag + 'EXIT')]
words = [line.split(None, 1)[0]
for line in helptext.split('\n')
if line.strip()]
commands = [word for word in words if word.isupper()]

dest = open('cmd_help.txt', 'wb')
p = subp.Popen("cmd.exe /X/D/F:ON", stdin=subp.PIPE,
stdout=dest, stderr=subp.STDOUT)
print >>p.stdin, "PROMPT (@@@@@@@@)"
print >>p.stdin, "HELP"
for command in commands:
print >>p.stdin, "HELP", command
print >>p.stdin, "EXIT"
p.wait()
dest.close()

Also, I found it invaluable to know that typing ALT+SPACE
in the CMD window took me to the options window (good for
pasting).

In moving to work on Windows, you will want a good text editor
(notepad is not enough for me), find an emacs or vim or whatever
and make sure you install it. I also carry around rcs and a
little utility I wrote called "recent." It'd be a good idea to
define your own utility directory, stick its name on your command
path and keep stuff in there. Either MingW32 or VC71 would be good
to have, both might be better. Good luck.

--Scott David Daniels
scott....@acm.org

Thomas Heller

unread,
Oct 14, 2005, 2:56:14 PM10/14/05
to
Scott David Daniels <scott....@acm.org> writes:

> Christian Stapfer wrote:
>> "John J. Lee" <j...@pobox.com> wrote in message
>> news:mailman.2039.112924...@python.org...
>>
>>>cmd.exe can be made bearable....
>>>
>>>0. Make a shortcut to cmd.exe, stick it somewhere get-at-able,
>>> eg. quick launch toolbar

> I put it on my desktop. Once having made it, fiddle with
> "Start in" to be your favorite python code directory (that is
> why I usually have several), and append a space and /D /X /F:ON
> to the "Target" line.

I have an elisp function bound to a key in XEmacs that starts cmd in the
directory where the current buffer is. IMO this is very convenient. To
access explorer from that command prompt (in the rare cases that I need
it) I use 'start .'.

Thomas

Trent Mick

unread,
Oct 14, 2005, 3:25:55 PM10/14/05
to pytho...@python.org, Thomas Heller
[Thomas Heller wrote]

> I have an elisp function bound to a key in XEmacs that starts cmd in the
> directory where the current buffer is. IMO this is very convenient. To
> access explorer from that command prompt (in the rare cases that I need
> it) I use 'start .'.

I kind of have the same thing with Dave's Quick Search Deskbar
(http://www.dqsd.net/) and my little "go" script
(http://trentm.com/projects/go/). The keystrokes to open a cmd.exe shell
in my "src" folder is down to:

<Windows+S> # to focus in the Quick Search Deskbar textbox
go src<Enter>

or to open Explorer in that dir:

go -o src<Enter>

or in another "tagged" dir:

go ~ # open in my home dir

DQSD is a fantastic tool for speeding up launching other things, too:
mainly Google searches.

Thomas Heller

unread,
Oct 14, 2005, 3:58:56 PM10/14/05
to
Trent Mick <tre...@ActiveState.com> writes:

Since we are speaking of tricks here:

I have other keys defined in XEmacs for context-sensitive help on the
word under the cursor in Python's htmlhelp file (F2), and the MSDN
library (F6). Kind of a hack which needs a small compiled C program,
though, since I did not know how to call the needed apis with elisp.

But, what I'm still missing is a function that finds and opens a Python
module.

Thomas

Fernando Perez

unread,
Oct 14, 2005, 5:43:05 PM10/14/05
to pytho...@python.org
> Kenneth McDonald a écrit :
>> For unfortunate reasons, I'm considering switching back to Win XP (from
>> OS X) as my "main" system. Windows has so many annoyances that I can
>> only compare it to driving in the Bay Area at rush hour (OS X is like
>> driving in Portland at rush hour--not as bad, but getting there), but
>> there are really only a couple of things that are really, absolutely
>> preventing me from making the switch. Number one is the lack of a
>> decent command line and command-line environment, and I'm wondering
>> (hoping) if perhaps someone has written a "Python shell"-- something
>> that will look like a regular shell, let users type in commands, maybe
>> have some of the nice features of bash etc. like tab completion, etc,
>> and will then execute an underlying python script when the command is
>> entered. I'm not thinking of IDLE, but something that is really aimed
>> more at being a system terminal, not a Python- specific terminal.
>>
>> Yes, I know that Cygwin is out there, but last I looked, they still
>> went through the Win command-line window, which imposes a lot of
>> restrictions.

You can look at ipython: http://ipython.scipy.org. Its 'pysh' profile does
much of what you describe, and has a dedicated following of win32 users
precisely for your usage case. It gets installed to your start menu under
win32 as a separate entry from the 'raw' ipython.

Stop by the users list if you have further questions.

Cheers,

f

Jorgen Grahn

unread,
Oct 15, 2005, 4:45:17 AM10/15/05
to
On Fri, 14 Oct 2005 12:37:25 +0200, Christophe <chris.c...@free.fr> wrote:
> Kenneth McDonald a écrit :
>> For unfortunate reasons, I'm considering switching back to Win XP (from
>> OS X) as my "main" system. Windows has so many annoyances that I can
...

>> Yes, I know that Cygwin is out there, but last I looked, they still
>> went through the Win command-line window, which imposes a lot of
>> restrictions.
...

> Last time I checked, you could install a native win32gui version of rxvt
> with cygwin. This would give you a better terminal window than that
> crappy thing you get in XP.

Last time /I/ checked (two years ago or so) that rxvt looked nice enough,
but was impossible to use in practice. I cannot remember /what/ the problem
was -- possibly it was that it could only run CygWin-compiled commands, or
something vital only worked with CygWin-compiled commands. Google probably
knows more.

I wouldn't be surprised if this has improved since then, or if someone else
has come up with a serious Win32 terminal. There is surely a need for one!

/Jorgen

--
// Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
\X/ algonet.se> R'lyeh wgah'nagl fhtagn!

qwwe...@yahoo.it

unread,
Oct 17, 2005, 1:10:43 PM10/17/05
to
Hi Claudio,
I fully agree with you. I already used AutoIt 3 but when I moved to
Linux I wasn't able to find anything similar.
I moved also to Python for its power but also if it is called a
scripting language it doesn't simply interact with graphical
applications. As a last resort I tried DCOP (Desktop COmmunication
Protocol) to at least interact
(also from Python) with KDE applications. But even there it is
impossible to send a simulated keystroke to a running KDE application
(for ex. the konqueror browser).
Also if I will not switch back to Windows, when I have macro and
automation problems I am obliged to use XP (I have double boot...).
Bye.

dave.b...@gmail.com

unread,
Oct 17, 2005, 2:43:12 PM10/17/05
to
Jorgen Grahn wrote:
> On Fri, 14 Oct 2005 12:37:25 +0200, Christophe <chris.c...@free.fr> wrote:
> > Kenneth McDonald a écrit :
> >> For unfortunate reasons, I'm considering switching back to Win XP (from
> >> OS X) as my "main" system. Windows has so many annoyances that I can
> ...
> >> Yes, I know that Cygwin is out there, but last I looked, they still
> >> went through the Win command-line window, which imposes a lot of
> >> restrictions.
> ...
> > Last time I checked, you could install a native win32gui version of rxvt
> > with cygwin. This would give you a better terminal window than that
> > crappy thing you get in XP.
>
> Last time /I/ checked (two years ago or so) that rxvt looked nice enough,
> but was impossible to use in practice. I cannot remember /what/ the problem
> was -- possibly it was that it could only run CygWin-compiled commands, or
> something vital only worked with CygWin-compiled commands. Google probably
> knows more.

Cygwin comes with a fully-functioning X server, from which you can run
just about any terminal program you like. For awhile, I was using
Konsole, but KDE on Cygwin is a bit slow and buggy. Recently I switched
to "mrxvt", which is like "rxvt" but with tab support and keyboard
shortcuts almost identical to Konsole. It's easy to compile for Cygwin,
and so far I'm really enjoying the improved speed. Here's my .mrxvtrc:

mrxvt*bottomTabbar: true
mrxvt*scrollBar: false
mrxvt*font: neep-alt-bold-14
mrxvt*boldFont: neep-alt-bold-14
mrxvt*foreground: snow
mrxvt*background: black
mrxvt*geometry: 80x40
mrxvt*saveLines: 65535
mrxvt*hotkey*Dummy: Ctrl+Shift+underscore

I like my tabs at the bottom, Konsole-style, and don't really like
scrollbars on terminals. I use the Neep Alt font, which is nice for
coding because it makes 'l', '|', '1', etc. all look different, and I
like thick console fonts. I was a Fixedsys diehard for a long time. The
"saveLines" variable lets you increase the scrollback buffer
(shift-PgUp/Down) pretty high - I have it maxxed out. And that last
line tells mrxvt to ignore C-_, which is undo in emacs. There are still
a few other keyboard bindings that I'd like to turn off at some point.

One drawback of mrxvt is that it doesn't support UTF-8. I don't do much
multi-language stuff, but on most Linux distributions the manpages are
in UTF-8, so you get garbage characters unless you fiddle with your
LANG/LOCALE settings.

Oh yeah, and to keep this on topic, Cygwin's Python works just fine in
mrxvt, though the native Windows version doesn't work so well. It
doesn't print any output, which I think is due to buffering... however,
I tend to use PythonWin for interactive development, and emacs with M-x
shell to actually test and run (native) Python scripts. I'm pretty
happy with it, overall.

Dave

kdah...@yahoo.com

unread,
Oct 18, 2005, 9:42:44 AM10/18/05
to
Hmm. I'm not sure what bothered you about cygwin, but if it has been
awhile it's worth another look. For me it makes windows tolerable, and
even productive.

I'm scared more by your thoughts of transitioning from OS-X to windows.
I've seen a bit of OS-X and am slowly be warmed up to it as an option
for my next machine by some folks here. What is causing you problems
with it ( enough to swtich to windows-wow.)?

Chris Lambacher

unread,
Oct 18, 2005, 1:00:37 PM10/18/05
to pytho...@python.org
The shell that comes with MSys (from the MinGW guys). Is pretty good, although
it does have a bit of a problem with stdout output before a process exits, ie
it will hold back output until the process exits.

As a bonus, the file system is a little more sane, and if you are interested
in compiling software that is not open source, you are not tied to the Cygwin
DLL which is GPLed.

I have given up on Cygwin in favour of the tools that come with MSys because
they seem slightly better suited to the windows environment.

-Chris

On Sat, Oct 15, 2005 at 08:45:17AM +0000, Jorgen Grahn wrote:
> On Fri, 14 Oct 2005 12:37:25 +0200, Christophe <chris.c...@free.fr> wrote:

> > Kenneth McDonald a ?crit :

> --
> http://mail.python.org/mailman/listinfo/python-list

Christopher Subich

unread,
Oct 19, 2005, 8:46:38 AM10/19/05
to
Chris Lambacher wrote:
> The shell that comes with MSys (from the MinGW guys). Is pretty good, although
> it does have a bit of a problem with stdout output before a process exits, ie
> it will hold back output until the process exits.
>
> As a bonus, the file system is a little more sane, and if you are interested
> in compiling software that is not open source, you are not tied to the Cygwin
> DLL which is GPLed.

Worth mentioning here that cygwin's gcc does allow a -mno-cygwin
compile-time flag to not link against the cygwin dll. Cygwin's
packaging system also includes the MinGW development libraries as an
easily installable option, for compiling against mingw's stuff; I've
done it for Python extensions, in fact.

robins...@gmail.com

unread,
Oct 19, 2005, 3:05:24 PM10/19/05
to
Try 4NT (http://www.jpsoft.com). It is like cmd on steroids. I've
been using it for years and it is the *only* thing that makes powerful
batch files possible on Windows. It has a slew of features, including
batch file debugging.

James Stroud

unread,
Oct 19, 2005, 3:22:14 PM10/19/05
to pytho...@python.org
The OP is obviously a troll. Or he doesn't realize that you can use any shell
in OSX as the user default. I used OSX for 4 years and had to go 100% Linux
because of my employer. OSX is the best of Linux and Windows--anybody who
can't see that has obviously not worked with these three types of operating
systems enough and is basing conclusions on limited information...Or is a
troll. The OP probably works for microsoft.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/

Simon Brunning

unread,
Oct 19, 2005, 3:57:00 PM10/19/05
to pytho...@python.org
On 19/10/05, James Stroud <jst...@mbi.ucla.edu> wrote:
> The OP is obviously a troll.

Hey - let's not throw the T word around quite so freely. The OP did
say that he was switching to Windows "for unfortunate reasons", and
that OSX was "not as bad" as Windows.

Besides, it is possible to prefer Windows. Odd, but possible. Having
moved from Windows to Mac recently myself, I know *I* won't be
switching back, but reasonable men can differ.

--
Though-clearly-not-differ-with-me-ly y'rs,
Simon B.

Fredrik Lundh

unread,
Oct 19, 2005, 5:30:11 PM10/19/05
to pytho...@python.org
robins...@gmail.com wrote:

> Try 4NT (http://www.jpsoft.com). It is like cmd on steroids. I've
> been using it for years and it is the *only* thing that makes powerful
> batch files possible on Windows.

why bother with "powerful batch files" when you can use a real programming
language ?

</F>

James Stroud

unread,
Oct 19, 2005, 6:23:16 PM10/19/05
to pytho...@python.org
First, my apologies. You sound sincere.

But, in my defense to jump to conclusions and comparisons:

(1) You compared first:

"Windows has so many annoyances that I can only compare it...Bay
Area...OS X...Portland..."

(2) "Unfortunate reasons" can not necessarily be interpreted as "beyond my
control". For instance, elected officials take office many times for
"unfortunate reasons." Not the least of which is often the ignorance of
the populace.

I propose that any time anyone suggests switching to Windows, the reasons for
such should be explicitly described, and not left to interpretation.

James

On Wednesday 19 October 2005 14:31, Kenneth McDonald wrote:
> Perhaps you didn't read my original post? I'm being forced to
> consider Windows
> for reasons beyond my control. Given that I wanted a decent shell in
> Windows,
> I thought I would ask about Python shells because I think Python is a
> great language,
> and such a beast would give me the flexibility I want on a machine I
> don't want to
> use.
>
> There is such a shell (though with a fifty page manual it'll be a
> little while before
> I start using it :-) ). End of matter, except for those who wish to
> discuss further
> Pythonish/shell related issues. Why this demands an OS comparison and an
> insult is beyond my understanding.
>
> Ken

Rocco Moretti

unread,
Oct 20, 2005, 11:01:55 AM10/20/05
to
James Stroud wrote:

> I propose that any time anyone suggests switching to Windows, the reasons for
> such should be explicitly described, and not left to interpretation.

I propose that any time anyone suggests switching to Linux ...
I propose that any time anyone suggests switching to Mac ...
I propose that any time anyone suggests switching to Ruby ...
I propose that any time anyone suggests switching to Firefox ...
I propose that any time anyone suggests switching to Waxed Dental Floss ...

People should not feel *required* to justify their decisions to c.l.py,
especially if they are not trying to evangelize that choice. (FWIW, even
from the original post it's very apparent that he's dissuading people
from joining him.)

It is true that giving the reasons for a choice will help responders put
some perspective on it, and perhaps prompt a few alternatives, but
c.l.py is not your mother, and shouldn't require you to justify the
validity of your lifestyle to it.

Steve Holden

unread,
Oct 20, 2005, 11:41:50 AM10/20/05
to pytho...@python.org

Man, you mean I can use any dental floss I like?!?!?!?!!?

regards
Steve

who quite agrees with the sentiments expressed above
(it's an extension of the "consenting adults" philosophy).
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

0 new messages