1

Can anybody help me how to run a python script through command line?

My python script http://buffis.com/2007/07/25/getting-info_hash-for-xbt-tracker/comment-page-1/

I am using this command /var/www/hash_info.py /var/www/Muha_Album.7912.torrent

I have copied dependency file bencode.py mentioned in article link above. When I execute the above command I get error No such file or directory but when i chmod the file to 644 it says Permission denied the file is present at the location.

I have installed pythong using this command apt-get install python-gtk2 python-glade2

3 Answers 3

4
python /var/www/hash_info.py /var/www/Muha_Album.7912.torrent
Sign up to request clarification or add additional context in comments.

Comments

3

Maybe it says:

bad interpreter: No such file or directory

Then, the first line, so called shebang line is the issue here. I guess you need to change it to where your python is really installed. On my Ubuntu installation it's /usr/bin/python.

Also, the solution from voyager should work for you as well.

1 Comment

To run a script from the current directory, after adding the shebang line, make sure you prefix the script name with a dot-slash to indicate that you want to run the file in the current directory, instead of some executable in the system: ./hash_info.py
0

Try chmod 744

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.