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 -- http://mail.python.org/mailman/listinfo/python-list