Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30672
| References | <CANy1k1i7XA3pTGeZeWk8V4osPkRoWxkSQJehhix9nHzDzO3HTg@mail.gmail.com> <CANy1k1g1dt6GQR80LWMkBt+YXzZXxtkUSV=qamWsS8mZXiyaAA@mail.gmail.com> <CAPTjJmrcsPgtcy6Aa5KJ8mRjFuB5b-FBanVQJ1o0M_PnHVpL2w@mail.gmail.com> <CANy1k1hzHqODvV7Eu64maOfCx8Os48wro56HG=uheyjqUos-uQ@mail.gmail.com> <CAPTjJmq2p5FLq8_w35qguoBhckBTdohb419j_jCWuvTP9vjKog@mail.gmail.com> |
|---|---|
| Date | 2012-10-02 21:49 -0600 |
| Subject | Re: parse an environment file |
| From | Jason Friedman <jason@powerpull.net> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1752.1349236170.27098.python-list@python.org> (permalink) |
> Ah, fair enough. Well, since you're using the full range of bash > functionality, the only viable way to parse it is with bash itself. > I'd recommend going with the version you have above: > >> * * * * * . /path/to/export_file && /path/to/script.py > > Under what circumstances is this not an option? That'd be the next > thing to consider. > > Alternatively, you may want to consider making your own config file > format. If you consciously restrict yourself to a severe subset of > bash functionality, you could easily parse it in Python - for > instance, always look for "export %s=%s" with simple strings for the > variable name and value. > Thank you, Chris, off-list post unintentional. It may be the case that I do not maintain /path/to/export_file; I might just be allowed to read it. Based on your responses and everyone's responses I'm guessing that what I am doing is sufficiently novel that there is no canned solution. I looked at shlex but did not see how that would be helpful. Thank you all for your thoughts.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: parse an environment file Jason Friedman <jason@powerpull.net> - 2012-10-02 21:49 -0600
csiph-web