def get_dir_path(sibling):
 py_file = __file__.replace('.pyc', '.py')
 dir_paths = [os.path.abspath(os.path.dirname(os.path.realpath(py_file))), os.path.abspath(os.path.dirname(py_file))]
 for dir_path in dir_paths:
  sibling_path = os.path.join(dir_path, sibling)
  if os.path.exists(sibling_path):
   return dir_path
 raise ValueError(('Could not determine directory that contains both, this file and %s.' % sibling))

def get_dir_path ( sibling ) : py_file = __file__ . replace ( '.pyc' , '.py' ) dir_paths = [ os . path . abspath ( os . path . dirname ( os . path . realpath ( py_file ) ) ) , os . path . abspath ( os . path . dirname ( py_file ) ) ] for dir_path in dir_paths : sibling_path = os . path . join ( dir_path , sibling ) if os . path . exists ( sibling_path ) : return dir_path raise ValueError ( ( 'Could not determine directory that contains both, this file and %s.' % sibling ) )
get a path to the directory of this script .