Setting an environment variable.
ashton at fagg.id.au
Tue Jan 3 00:45:20 EST 2012
A bit new to Python so please forgive my potential ignorance.
I'm working with an embedded machine, which is using a Python script to
oversee the acquisition of some data. The supervisor script, which is
run by crontab every 5 minutes, relies on an environment variable to be
set. I've tried to set the environment variable inside crontab, however
this doesn't work when the script runs.
Is there a nice way to do this inside the supervisor script itself?
Would an os.system("export foo=/bar/foo/bar") at the very beginning of
the script do what I want? I would just like to check before I make
changes, as being an embedded machine it's a bit of a pain to update
things like this...(read only file system)
Note: This is for Python 2.4. I have no ability to update to anything
newer as this is what our codebase relies upon.
Thanks and regards,
Ashton Fagg (ashton at fagg.id.au)
Keep calm and call Batman.
More information about the Python-list