Hi all, I need a cleaner ( and shorter ) way to to look in my home directory or any directory for a directory called modules. This is what I currently have - but it is really ugly. Some a few of you experts point me to a cleaner more pythonic approach?
mod = 0 if os.path.exists( os.environ['HOME'] + "/modules"): sys.path.insert( 0, os.environ['HOME'] + "/modules") mod =1 else: path = os.environ['PWD'] while path != "/": if os.path.exists( path + "/modules"): sys.path.insert( 0, path + "/modules") mod= 1 path = "/" else: path = os.path.split(path)[0] if mod: from foo import foo -- http://mail.python.org/mailman/listinfo/python-list