Skip to content

Instantly share code, notes, and snippets.

@jimmycuadra
Created September 13, 2013 06:50
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 jimmycuadra/6547407 to your computer and use it in GitHub Desktop.
Save jimmycuadra/6547407 to your computer and use it in GitHub Desktop.
Add the current package's dir to sys.path if the file is being run directly.
import sys
import os
if __name__ == '__main__':
package_path = os.path.abspath(os.path.join(__file__, '..', '..'))
sys.path.insert(0, package_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment