Hank Wilkinson wrote:

> I am trying to do script in python using "./"
> Here is a session showing "bad interpreter: No such file or directory"
> Is this a python question/problem?

It's a bash problem. The shell cannot cope with Windows line endings: ^M in 
the error message stands for chr(13) or Carriage Return. 

> -bash: ./hello.py: /usr/local/bin/python3.1^M: bad interpreter: No such
> file or directory John-Wilkinsons-iMac:p31summerfield wilkinson$ echo

There is a utility program called dos2unix to convert line endings, but I 
don't know if it's available on the Mac.

$ cat -v tmp.py
#!/usr/bin/python^M
print "hello"^M
$ ./tmp.py
bash: ./tmp.py: /usr/bin/python^M: bad interpreter: No such file or 
directory
$ dos2unix tmp.py
$ ./tmp.py
hello
$


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to