Skip to content

Instantly share code, notes, and snippets.

@ento
Created June 9, 2009 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ento/126562 to your computer and use it in GitHub Desktop.
Save ento/126562 to your computer and use it in GitHub Desktop.
Get script's own location in Python
import os
local_dir = os.path.dirname(__file__)
abs_dir = os.path.join(os.getcwd(), local_dir)
if __name__ == "__main__":
print("Hello World!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment