docstring says "execute sitedir" - but that isn't what gets executed. suggested: """Add a new path to known_paths by combining sitedir and 'name' or execute lines in name.pth that start with 'import'""" site.py def addpackage(sitedir, name, known_paths): """Add a new path to known_paths by combining sitedir and 'name' or execute sitedir if it starts with 'import'""" fullname = os.path.join(sitedir, name) f = open(fullname, "rU") for line in f: if line.startswith("import"): exec line
Here is a patch. addpackage() is actually responsible for .pth file processing, so the current docstring was entirely incorrect. File Added: addpackage_docstring.diff