Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30578 > unrolled thread
| Started by | Dave Angel <d@davea.name> |
|---|---|
| First post | 2012-09-30 20:58 -0400 |
| Last post | 2012-09-30 20:58 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: parse an environment file Dave Angel <d@davea.name> - 2012-09-30 20:58 -0400
| From | Dave Angel <d@davea.name> |
|---|---|
| Date | 2012-09-30 20:58 -0400 |
| Subject | Re: parse an environment file |
| Message-ID | <mailman.1686.1349053129.27098.python-list@python.org> |
On 09/30/2012 08:11 PM, Jason Friedman wrote: First comment: I don't know anything about an "environment file." An environment is an attribute of a process, and it's inherited by subprocesses that process launches. This is not a Python thing, it's an OS thing, for whatever OS you're running. > $ crontab -l > * * * * * env > > This produces mail with the following contents: > > HOME=/home/spjsf > LOGNAME=spjsf > PATH=/usr/bin:/bin > PWD=/home/spjsf > SHELL=/bin/sh > SHLVL=1 > USER=spjsf > _=/usr/bin/env In other words, these are the environment variables that cron has, and that it gives to any children it launches. > On the other hand > > $ env > > produces about 100 entries, most of which are provided by my .bashrc; > cron provides only a limited number of environment variables. Gee, those are variables specific to a particular (bash) shell, so how would a program launched by cron know about them? > I want my python 3.2.2 script, called via cron, to know what those > additional variables are. How? You'd have to change the environment that cron sees (before login), or add to the crontab, or /etc/default/cron, or else run some shell from cron that defines those variables and then runs the application. The way to do this is specific to whatever OS you're running, and is irrelevant to Python. Try googling. For some examples, none of which use Python: http://www.perlmonks.org/?node_id=624540 http://www.unix.com/solaris/164483-environment-variables-cron.html http://www.computing.net/answers/unix/how-to-set-environment-variable/5689.html http://linuxshellaccount.blogspot.com/2007/10/crontab-and-your-environment.html -- DaveA
Back to top | Article view | comp.lang.python
csiph-web