def add_to_path(path):
 if (not os.path.isdir(path)):
  raise RuntimeError('Tried to add nonexisting path')
 def _samefile(x, y):
  if (x == y):
   return True
  try:
   return os.path.samefile(x, y)
  except (IOError, OSError, AttributeError):
   return False
 sys.path[:] = [x for x in sys.path if (not _samefile(path, x))]
 sys.path.insert(0, path)

def add_to_path ( path ) : if ( not os . path . isdir ( path ) ) : raise RuntimeError ( 'Tried to add nonexisting path' ) def _samefile ( x , y ) : if ( x == y ) : return True try : return os . path . samefile ( x , y ) except ( IOError , OSError , AttributeError ) : return False sys . path [ : ] = [ x for x in sys . path if ( not _samefile ( path , x ) ) ] sys . path . insert ( 0 , path )
adds an entry to sys .