Aug 262010
for i in range(0, len(sys.path)): if sys.path[i].find("~") > -1: sys.path[i] = path.expanduser(sys.path[i]) break else: sys.path.insert(1,path.expanduser("~/lib/python"))
More duct tape code to allow me to rely on ~/lib/python to store common code (ex. apache log parsing & analysis ) when PYTHONPATH might not be set or
set incorrectly.
Basically if ~ is found in sys.path, the break statement skips the else. Alternatively, if not found then else is executed.
Python compound statements: For loops
Sorry, the comment form is closed at this time.