Skip to content

Instantly share code, notes, and snippets.

@mirth
Last active August 29, 2015 14:11
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 mirth/ed60f24d17a3897bded6 to your computer and use it in GitHub Desktop.
Save mirth/ed60f24d17a3897bded6 to your computer and use it in GitHub Desktop.
This gist adds parent directory to sys.path to be able import files from parent directory.
if __name__ == '__main__' and __package__ is None:
from os import sys, path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment