Skip to content

Instantly share code, notes, and snippets.

@ento
Created June 9, 2009 15:03
Show Gist options
  • 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