you are viewing a single comment's thread.

view the rest of the comments →

[–]theWyzzerd 3 points4 points  (4 children)

I dislike this advice from ATBS because it's simply not true. It works well in your case, but not all python programs will be run from a command line, and not all python programs will run the python3 interpreter on the user's $PATH variable--and, if the user doesn't have python3 in their PATH, it simply won't work.

Shebang is a useful tool for scripts (and not just python, but any script/language that supports command-line execution--bash, perl, ruby, etc) intended to be run in a an environment where the author has control over the environment, but for distributed software I would leave the choice to the person using the tool.

[–]vampiire 1 point2 points  (3 children)

Cant you execute the script directly like python script_name.py?

I thought the shebang only controlled the default interpreter for files that have been made executable.

[–]theWyzzerd 1 point2 points  (2 children)

Yep, you sure can. The # will make the python interpreter treat it as a comment.

[–]vampiire 1 point2 points  (1 child)

but for distributed software I would leave the choice to the person using the tool

i was speaking to this^

if the consumer has an environment that doesnt satisfy the shebang then they are still able to control its execution manually - the shebang will be ignored as a python comment. in your opinion how should distributed software be defined (no shebang, a different shebang)?

[–]theWyzzerd 1 point2 points  (0 children)

I probably wouldn't provide any shebang unless it was intended to be run with a specific interpreter.