I normally use Python's own: import sys print sys.path[0] sys.path is a sequence with all paths that will be inspected whenever a module must be searched by import/from * import. The firt element is the directory of the running script.