Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. def addpackage(sitedir, name, known_paths):
  2.     """Process a .pth file within the site-packages directory:
  3.       For each line in the file, either combine it with sitedir to a path
  4.       and add that to known_paths, or execute it if it starts with 'import '.
  5.    """
  6.     if known_paths is None:
  7.         known_paths = _init_pathinfo()
  8.         reset = True
  9.     else:
  10.         reset = False
  11.     fullname = os.path.join(sitedir, name)
  12.     print(fullname)
  13.     try:
  14.         f = open(fullname, "r")
  15.     except OSError:
  16.         return
  17.     with f:
  18.         for n, line in enumerate(f):
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement