WinNT problem with Python and Cygwin Bash

David Bolen db3l at fitlinxx.com
Mon Mar 26 21:55:01 EST 2001


Don Dwiggins <dwig at advancedmp.net> writes:

> I've just installed Happydoc (nice!) on my WinNT box, and am having a bit of
> a problem running the shell script generated by the installer under Cygwin
> using Bash.  It looks as though Bash is passing Python a Unix-style pathname
> (/e/Python20/Scripts/happydoc), but Python expects a Windows-style pathname,
> so complains it can't find the file.  I can work around it by applying some
> "Bash grease", but I'd like to know if anyone else has run across this, and
> if there's a simple fix.

In general, Python (or any program using the Win32 API) can handle
forward slashes or backslashes in paths without any problem.

However, am I correct in guessing that "/e" isn't actually a top level
directory on your current drive, but rather a Cygwin mount point for
your E: drive?  If that's the case, then you'll definitely have a
problem because there's no way for Python (unless you've built a
Cygwin version of it) to handle that mount translation, as such
translation is built into the Cygwin DLL.

Alternatively, if /e really is a directory off of your Cygwin root,
but your Cygwin root drive is not the same drive you are "on" when
running the script, again, Windows won't like it since it will
interpret the leading "/" as being the root directory of the _current_
drive.

In either case, you can use the cygpath utility to convert any Cygwin
path into a Windows path (or vice versa, or other conversions), and it
will handle replacing any mount references with appropriate Windows
native paths and adding drive references as necessary.

So if you modify the created shell script slightly to take whatever
pathname it would normally send into Python and run it through
"cygpath -w" first, you should be ok.  Or, just create a small
front-end shell script to run instead of Python which can do the
expansion and then call Python, and tell the Happydoc created script
to run that instead of Python.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list