At times, you will have to get and set environment variables to get the desired effect in your scripts. The os module offers this function through a dictionary like object called environ.
import os homedir = os.environ['HOME'] if not '/opt/mysuite/bin' in os.environ['PATH']: os.environ['PATH'] += ':/opt/mysuite/bin' os.system('mysuiteapp') # Executable in /opt/mysuite/bin
Posted by
on January 14, 2009
at 5:41
Tagged as:
python
shell_scripting
