Skip to content

Instantly share code, notes, and snippets.

@rickcnagy
Last active December 19, 2015 10:39
Show Gist options
  • Save rickcnagy/5942187 to your computer and use it in GitHub Desktop.
Save rickcnagy/5942187 to your computer and use it in GitHub Desktop.
chdir to script's actual path in Python 2.7 - necessary when firing scripts from cron
#cd to the script's directory in case it is not the current working directory
os.chdir(os.path.dirname(os.path.abspath(__file__)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment