Skip to content

Instantly share code, notes, and snippets.

@bmnn
Created November 29, 2013 22:52
Show Gist options
  • Save bmnn/7713066 to your computer and use it in GitHub Desktop.
Save bmnn/7713066 to your computer and use it in GitHub Desktop.
python; import; module; path;
#r# (url='http://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path')
# \ldots The advantage of adding a path to sys.path (over using imp) is that it simplifies things when importing more than one module from a single package. For example: \ldots
import sys
# the mock-0.3.1 dir contains testcase.py, testutils.py & mock.py
sys.path.append('/foo/bar/mock-0.3.1')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment