Skip to content

Instantly share code, notes, and snippets.

@nkabir
Created November 27, 2011 18:43
Show Gist options
  • Save nkabir/1397960 to your computer and use it in GitHub Desktop.
Save nkabir/1397960 to your computer and use it in GitHub Desktop.
Python Runner Scripts
#!/usr/bin/env python
import sys
if __name__ == "__main__":
print sys.argv
#!/usr/bin/env bash
# usage: pyrunner.sh [python-script] [arguments] ...
# Let's set our PYTHONPATH so our python script can load all needed libraries
export PYTHONPATH=$HOME/hgdev/org.bitbucket/$USER/pywork
# The first argument is the name of the python script we want to run
pyscript=${1}
# the "shift" command moves all arguments to the left, deleting the first one
shift
# The $@ is a special Bash variable that contains the list of command line arguments
python ${pyscript} $@
$ ./pyrunner.sh paypv.py 1 2 3 4 5
['paypv.py', '1', '2', '3', '4', '5']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment