On 03/20/2014 10:10 AM, notbob wrote:
On 2014-03-20, Zachary Ware <zachary.ware+pyl...@gmail.com> wrote:

If you're specifying the interpreter in your command (by calling
"python <scriptname>.py", etc), the shebang won't mean anything
anyway.
DOH!

I was following you, fine, until that last sentence.  Then how should
I invoke the scripts? ....as your example is exactly how I've been
doing it with 2.7, as per Learn Python the Hard Way.  Simply
./<scriptname>.py from the appropriate directory (assuming I keep both
vers in separate dirs)?

nb

If you mark your script as executable (chmod ...) and include the shebang line, and place it in a directory included in your search path (mine is ~/bin), then you run it as you run any installed program: Just type it's name followed by any command line args. I usually remove the .py portion of the name as I copy it into my bin directory so it really does look like any other installed program.

If you need to be in a specific directory when you run it, then perhaps you should consider a bit of a rewrite to remove this constraint.

Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to