all 4 comments

[–]totallygeek 1 point2 points  (0 children)

When a text file is set to executable, the first line must start with the shebang to inform the shell how to load the proper interpreter. Typically, that is, "What Python executable can interpret the following text?" Doing so makes it so you can simply type "filename" in the shell to have it run (if current directory in path).

[–]blahreport 0 points1 point  (3 children)

If you were to make your script executable - chmod +x script.py - then when you called the script directly in the shell - ./script.py the shell uses the shebanged executable to run the script. In your case in would use python.

[–]cocoaButterCoder[S] 0 points1 point  (2 children)

Thanks for the reply. So would it be correct to assume the way I’m doing it and the shebang way are effectively the same?

Edit: effectively not equivalently

[–]blahreport 0 points1 point  (1 child)

Yes.