[module] cygwin directory browser

Mark Hadfield m.hadfield at niwa.co.nz
Wed Jan 23 17:30:20 EST 2002


"Anton Vredegoor" <anton at vredegoor.doge.nl> wrote in message
news:a2mbkc$q7j$1 at news.hccnet.nl...
> line 62: sys.path.append(r'c:/Program Files/python22/Tools/Idle')

Yes this does work, so does:

sys.path.append(r'c:\\Program Files\\python22\\Tools\\Idle')

I prefer the latter because it's clear that what's being represented is a
Windows path.

Maybe what's happening is that by adding the Idle directory to the path,
we're dragging Windows Tcl and Tk into the equation as well as Cygwin
Tkinter. And Windows Tcl and Tk obviously wouldn't understand Unix-style
paths. ...Then again maybe not.

> If you can do: "cd /disk0/" in your shell, you could use "/disk0/"
> instead of "/cygdrive/". In my shell only "cd /cygdrive/" or "cd c:/"
> and such works so I can't check this "/disk0/" alternative.

/disk0 is just a mount point on my Cygwin system, pointing to C:\. I've been
thinking recently that I might omit it and use /cygdrive/c instead. But this
points to a weakness in your cygdir script: it doesn't know what directories
are mounted under /. It assumes there is a /cygdrive and does the equivalent
of "ls /cygdrive". This scans all the disks on the machine and comes up with
a list: "a c d e" or whatever. But doing "ls /" does not find /cygdrive, or
any of the other mount points.

BTW I have both Cygwin and native-Windows versions of Python on my system. I
have a similar directory-choosing script to yours, but implemented in
native-Windows Python using the WxPython directory-dialogue. I wrote it some
time ago but I find that I don't use it much. What I tend to do is track
down the directory I want in Explorer and open a bash prompt or Python
prompt there. Or cd to it in bash using its excellent input-completion
facilities.
---
Mark Hadfield
m.hadfield at niwa.co.nz  http://katipo.niwa.co.nz/~hadfield
National Institute for Water and Atmospheric Research






More information about the Python-list mailing list