Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30611
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <dihedral88888@googlemail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'bash': 0.07; 'skip:/ 10': 0.07; 'subject:file': 0.07; 'wrapped': 0.07; 'python': 0.09; 'imported.': 0.09; 'scripts,': 0.09; 'subset': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'itself.': 0.11; 'value.': 0.15; 'ah,': 0.16; 'consciously': 0.16; 'dictionary,': 0.16; 'enough.': 0.16; 'merely': 0.16; 'oct': 0.16; 'wrote:': 0.17; 'config': 0.17; 'exists': 0.17; 'instance,': 0.17; 'module': 0.19; 'variable': 0.20; 'file.': 0.20; 'decorators': 0.22; 'parse': 0.22; "i'd": 0.22; 'cc:2**0': 0.23; 'dependent': 0.23; 'monday,': 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'ago': 0.27; 'am,': 0.27; 'format,': 0.27; 'functions.': 0.27; 'restrict': 0.27; 'chris': 0.28; 'oversight': 0.29; 'wrap': 0.29; 'file': 0.32; 'could': 0.32; 'version': 0.34; 'received:google.com': 0.34; 'from:addr:googlemail.com': 0.35; 'jason': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'next': 0.35; 'october': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'sure': 0.38; 'instead': 0.39; 'easily': 0.39; 'think': 0.40; 'your': 0.60; 'range': 0.60; 'times': 0.63; 'making': 0.64; 'iron': 0.65; 'stated': 0.69; 'hoping': 0.72; 'yourself': 0.77; 'object:': 0.84; 'viable': 0.84; 'severe': 0.91 |
| Newsgroups | comp.lang.python |
| Date | Mon, 1 Oct 2012 08:29:22 -0700 (PDT) |
| In-Reply-To | <mailman.1705.1349102521.27098.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=123.192.32.215; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw |
| References | <CANy1k1i7XA3pTGeZeWk8V4osPkRoWxkSQJehhix9nHzDzO3HTg@mail.gmail.com> <CANy1k1g1dt6GQR80LWMkBt+YXzZXxtkUSV=qamWsS8mZXiyaAA@mail.gmail.com> <CAPTjJmrcsPgtcy6Aa5KJ8mRjFuB5b-FBanVQJ1o0M_PnHVpL2w@mail.gmail.com> <CANy1k1hzHqODvV7Eu64maOfCx8Os48wro56HG=uheyjqUos-uQ@mail.gmail.com> <mailman.1705.1349102521.27098.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 123.192.32.215 |
| MIME-Version | 1.0 |
| Subject | Re: parse an environment file |
| From | 88888 Dihedral <dihedral88888@googlemail.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Message-ID | <mailman.1708.1349105372.27098.python-list@python.org> (permalink) |
| Lines | 74 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1349105372 news.xs4all.nl 6881 [2001:888:2000:d::a6]:45075 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:30611 |
Show key headers only | View raw
On Monday, October 1, 2012 10:42:02 PM UTC+8, Chris Angelico wrote: > On Tue, Oct 2, 2012 at 12:37 AM, Jason Friedman <jason@powerpull.net> wrote: > > >> Is there a reason to use that format, rather than using Python > > >> notation? I've at times made config files that simply get imported. > > >> Instead of a dictionary, you'd have a module object: > > >> > > >> > > >> # config.py > > >> VAR1='foo' > > >> VAR2='bar' > > >> VAR3=VAR1+VAR2 > > >> > > > There is a reason: /path/to/export_file exists for Bash scripts, too, > > > and I do not think I could get Bash to read config.py in the format > > > stated above. I want to maintain only one file. > > > > (Responding on-list and hoping it was merely oversight that had that > > email come to me personally) > > > > 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. > > > > ChrisA I think one can ues some decorators to wrap OS or platform dependent functions. I am sure someone did that long time ago as the iron python wrapped dot-net.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: parse an environment file Chris Angelico <rosuav@gmail.com> - 2012-10-02 00:41 +1000 Re: parse an environment file 88888 Dihedral <dihedral88888@googlemail.com> - 2012-10-01 08:29 -0700 Re: parse an environment file 88888 Dihedral <dihedral88888@googlemail.com> - 2012-10-01 08:29 -0700
csiph-web