0

Hello Stack Overflow Saviors, I have the following script in python

#!usr/bin/env python
# Years till 100

import sys

name = sys.argv[1]
age = int(sys.argv[2])
diff = 100 -age
print name, "will be 100 in", diff

I wrote it using nano, then saved it as timetill100.py, used chmod u+x timetill100.py but when I run ./timetill100.py I get the following error :

bash: ./timetill100.py: usr/bin/env: bad interpreter: No such file or directory

but when I run python timetill100.py andy 25 it works wonderfully.
I picked up scripting in python a few hours ago, so please tell me where I'm failing.

1 Answer 1

7

Your shebang line is wrong:

#!/usr/bin/env python

As you had it, the script was trying to execute usr/bin/env, not /usr/bin/env :-)

Sign up to request clarification or add additional context in comments.

1 Comment

Omg, I'm so stupid :'D I'll accept the answer as soon as possible

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.