parse an environment file
Jason Friedman
jason at powerpull.net
Mon Oct 1 10:12:50 EDT 2012
> I want my python 3.2.2 script, called via cron, to know what those
> additional variables are. How?
Thank you for the feedback. A crontab line of
* * * * * . /path/to/export_file && /path/to/script.py
does indeed work, but for various reasons this approach will not
always be available to me.
Let me restate my question. I have a file that looks like this:
export VAR1=foo
export VAR2=bar
# Comment
export VAR3=${VAR1}${VAR2}
I want this:
my_dict = {'VAR1': 'foo', 'VAR2': 'bar', 'VAR3': 'foobar'}
I can roll my own, but I'm thinking there is a module or existing code
that does this. I looked at the os and sys and configparse modules
but did not see it.
More information about the Python-list
mailing list