Reputation: 3632
I want to make a script that has a lot of options and easy to use. For example, to use the script, I normally have to type:
workon my_env
python my_script.py -o1 option1 -o2 option2
But how to make this easy like the way fabric does? Like:
my_script -O1 option1 -o2 option2
Upvotes: 1
Views: 97
Reputation: 4253
One option is to add #!/usr/bin/python (this should be the first line) to your script file and make it executable.
Upvotes: 0
Reputation: 771
You can make your script start with the line: #!/usr/bin/env python
Or, depending on your version: #!/usr/bin/env python3.3
Then you must make your script executable with a chmod
, and it should work like you want!
Upvotes: 4