Is there a way to set the terminal path in Python? I have some compiled binaries that I'll like to use in a folder, let's just say foo.exe in C:/Program Files/PostgreSQL/9.2/bin, and I figured there had to be something in the os or sys modules that would work, but I couldn't find any:
# This works, but ugly
psqldir = 'C:/Program Files/PostgreSQL/9.2/bin'
currentdir = os.getcwd()
os.chdir(psqldir)
os.system('foo')
os.chdir(currentdir)
# Does not work
os.system('set PATH=%PATH%;C:/Program Files/PostgreSQL/9.2/bin')
os.system('foo')
# Does not work
sys.path.append('C:\\Program Files\\PostgreSQL\\9.2\\bin')
os.system('foo')
Thanks!
os.system()? Not good...subprocessmodule".