I have a .pth file which has some logic in it - but it isn't quite enough...
It started with this.. import os, site; site.addsitedir(os.path.join(os.environ["TECHROOT"], "tools/python/modules")) But that eventually evolved into.. import os, site; site.addsitedir(os.path.join(os.environ.get ("TECHROOT", "/home/tech"), "tools/python/modules")) But now I want to check to make sure this directory exists or fall back to "/home/tech". That was the point of the environ.get but what if someone sets TECHROOT to /dev/null. Well that will break things... I tried this but no go. Can someone help me out.. import os, site; smsc = os.environ.get("TECHROOT", "/home/tech"); if not os.path.isdir(smsc): smsc = "/home/tech"; site.addsitedir (os.path.join(smsc, "tools/python/Linux/%arch/lib/python2.5/site- packages")) Apparently there is a problem with the if statement??? Thanks -- http://mail.python.org/mailman/listinfo/python-list