problem executing python scripts in cygwin bash shell

David Humphrey dhumphrey at pdqdot.net
Thu Apr 5 13:58:39 EDT 2001


I'm sure this one has been answered before, but I couldn't find the solution
in any of the newgroups, so here goes again.

I can run bash scripts that are in the path but not python scripts.  Each
script has the appropriate (I think) #! declaration on the first line.
Here's a short record of my tests:

$ pwd
/home/administrator

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/cygdrive/c/WINNT/system32:/cygdrive/c/WINNT:/c
ygdrive/c/BGIUtils:/cygdrive/d/Utils/Python20/:/cygdrive/d/Utils/ULTRAE~1:/c
ygdrive/d/Utils/Perl/bin/:/cygdrive/d/dlh/bin:.

$ ls -al /usr/local/bin
total 1
drwxr-xr-x   2 administ None            0 Jan 10 16:01 .
drwxr-xr-x   5 administ None            0 Jan 10 16:01 ..
-rwxr-xr-x   1 administ None           59 Apr  5 11:35 test.sh
-rwxr-xr-x   1 administ None           77 Apr  5 11:34 test1.py
-rwxr-xr-x   1 administ None           92 Apr  5 11:39 test2.py

$ cat /usr/local/bin/test.sh
#!/usr/bin/bash
echo "Hello, World (from the bash script)"

$ cat /usr/local/bin/test1.py
#!d:/Utils/python20/python.exe
print "Hello, World (from the python script)"

$ cat /usr/local/bin/test2.py
#!/cygdrive/d/Utils/python20/python.exe
print "Hello, World (from the python test2 script)"

$ test.sh
Hello, World (from the bash script)

$ test1.py
d:\Utils\python20\python.exe: can't open file '/usr/local/bin/test1.py'

$ test2.py
d:\Utils\python20\python.exe: can't open file '/usr/local/bin/test2.py'

$


>From this, I infer that cygwin bash understands the #! notation properly, so
I must have a problem with paths or some other configuration parameter.
Also, I've run these same tests with c:\ instead of /cygdrive/c and d:\
instead of /cygdrive/d.

Has someone out there been successful doing this?

Configuration details:

Windows NT 4.0
GNU bash, version 2.04.5(12)-release (i686-pc-cygwin)
ActiveState Python 2.0.3

Regards,
David L. Humphrey
Manager, Software Development
Bell Geospace, Inc












More information about the Python-list mailing list