[IPython-user] Passing env or python variables to scripts/executables?

Angus McMorland amcmorl@gmail....
Mon Apr 21 13:35:03 CDT 2008


On 21/04/2008, Pettit, Keith (SAIC) <Keith.Pettit@bp.com> wrote:
> Is there a way to use ipython or system environment variables when I call
> scripts.  For example when I want to do rsync, is there a way I can do the
> equivelant of "rsync $HOME/dev/* $backup/dev/."  I'd be nice if there was a
> way I could use either enviornment or python variables, but I'd be happy
> with either.

Not sure if this is what you're after, but you can access environment
variables in python via os.environ. For e.g.

myhome = os.environ.get('HOME')

Angus.
-- 
AJC McMorland, PhD candidate
Physiology, University of Auckland

(Nearly) post-doctoral research fellow
Neurobiology, University of Pittsburgh


More information about the IPython-user mailing list