def path_to_resource(project, path, type=None):
 project_path = path_relative_to_project_root(project, path)
 if (project_path is None):
  project_path = rope.base.project._realpath(path)
  project = rope.base.project.get_no_project()
 if (type is None):
  return project.get_resource(project_path)
 if (type == 'file'):
  return project.get_file(project_path)
 if (type == 'folder'):
  return project.get_folder(project_path)
 return None

def path_to_resource ( project , path , type = None ) : project_path = path_relative_to_project_root ( project , path ) if ( project_path is None ) : project_path = rope . base . project . _realpath ( path ) project = rope . base . project . get_no_project ( ) if ( type is None ) : return project . get_resource ( project_path ) if ( type == 'file' ) : return project . get_file ( project_path ) if ( type == 'folder' ) : return project . get_folder ( project_path ) return None
get the resource at path you only need to specify type if path does not exist .