Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18376

Setting an environment variable.

Date 2012-01-03 15:45 +1000
From Ashton Fagg <ashton@fagg.id.au>
Subject Setting an environment variable.
Newsgroups comp.lang.python
Message-ID <mailman.4333.1325569526.27778.python-list@python.org> (permalink)

Show all headers | View raw


Hi list.

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.

-- 
Ashton Fagg (ashton@fagg.id.au)
Web: http://www.fagg.id.au/~ashton/

Keep calm and call Batman.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Setting an environment variable. Ashton Fagg <ashton@fagg.id.au> - 2012-01-03 15:45 +1000
  Re: Setting an environment variable. Nobody <nobody@nowhere.com> - 2012-01-03 20:29 +0000

csiph-web