problem executing python scripts in cygwin bash shell
John J. Lee
phrxy at csv.warwick.ac.uk
Fri Apr 6 21:25:11 EDT 2001
On 6 Apr 2001, Douglas Alan wrote:
> "John J. Lee" <phrxy at csv.warwick.ac.uk> writes:
>
> > Aha! Good idea. Perhaps even better:
>
> > #!/bin/sh
>
> > temp = "$@ "
> > //d/apps/Python20/python `cygpath -w $1` ${temp#* }
>
> Good idea, but not quite right. You really want:
>
> #!/bin/sh
>
> exec //d/apps/Python20/python "`cygpath -w $1`" ${1+"$@"}
[...]
Hmm, have you actually tried executing that?
I'm no fan of shell scripting and tend to avoid it, so perhaps I'm missing
something, but your modification of my little script doesn't appear to
work (tst.py just prints out sys.argv).
Your script:
$ //c/Python20/Local/tst.py
['c:\\Python20\\Local\\tst.py', '//c/Python20/Local/tst.py']
$ //c/Python20/Local/tst.py foo bar
['c:\\Python20\\Local\\tst.py', '//c/Python20/Local/tst.py', 'foo', 'bar']
My script:
$ //c/Python20/Local/tst.py
['c:\\Python20\\Local\\tst.py']
$ //c/Python20/Local/tst.py foo bar
['c:\\Python20\\Local\\tst.py', 'foo', 'bar']
tst.py looks like this:
#!/usr/bin/env python
import sys
print sys.argv
(did that test just as my laptop's batteries were going flat, so apologies
for any typos)
John
More information about the Python-list
mailing list