How come when I run python programs from terminal, I have to write "python file.py" or "python3.2 file.py" ? If I'm including a shebang line specifying that the program should be opened with python 3.2 interpreter, shouldn't it automatically open with python3.2 w/o specifying "python3.2 file.py". Shouldn't I just only have to specify the file name, "file.py"?
3 replies to this topic
#1
Posted 17 June 2011 - 09:49 PM
|
|
|
#2
Posted 17 June 2011 - 10:10 PM
What is the very first line in your file.py?
Some shells are picky on how it is formed, you may wish to check the format and paths as well. You may need to set it as an executable first, i.e.
Some shells are picky on how it is formed, you may wish to check the format and paths as well. You may need to set it as an executable first, i.e.
chmod +x file.py ./file.py
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 18 June 2011 - 08:36 AM
Haha, yeah I forgot you had to do "./file.py" I felt like I was forgetting something, but couldn't think of what it was.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









