How can I make any of the python script in wheezy python_games run at the command line.
I tried by first placing at line 1
#! /usr/bin/python2.7
or
#! /usr/bin/env python2.7
Then permissions "chmod ugo+rwx filename.py"
then ./filename.py in a terminal opened in python_games
I get
bash: ./filename.py: /usr/bin/python2.7^M: bad interpreter: No such file or directory.
Thanks
start python script from command line
4 posts
- Posts: 35
- Joined: Wed Jun 27, 2012 6:46 pm
- Location: New Zealand
pmonro wrote:How can I make any of the python script in wheezy python_games run at the command line.
I tried by first placing at line 1
#! /usr/bin/python2.7
or
#! /usr/bin/env python
Then permissions "chmod ugo+rwx filename.py"
then ./filename.py in a terminal opened in python_games
see http://freshtutorial.com/execute-python ... spy-linux/
I get
bash: ./filename.py: /usr/bin/python2.7^M: bad interpreter: No such file or directory.
Thanks
- Posts: 35
- Joined: Wed Jun 27, 2012 6:46 pm
- Location: New Zealand
pmonro wrote:bash: ./filename.py: /usr/bin/python2.7^M: bad interpreter: No such file or directory.
Thanks
My guess would be that you have written your file on a windows machine. The ^M indicates that it has DOS http://en.wikipedia.org/wiki/Newline end-of-line characters. There is a handy utility called dos2unix than can be installed
- Code: Select all
sudo apt-get install dos2unix
that will convert from DOS style end-of-line characters to UNIX style.
- Posts: 136
- Joined: Sat Jan 21, 2012 8:13 am
- Location: Melbourne, Australia
AH well I got it to work OK but all I did different was to give the file another name
- Posts: 35
- Joined: Wed Jun 27, 2012 6:46 pm
- Location: New Zealand