Re: Python does not get environment variable when using cron.

2008-08-18 Thread Asun Friere
On Aug 18, 11:17 pm, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > > The easiest solution (in my opinion) is to write a bash script to > execute your Python script, and use that bash script to add those > environment variables. Agreed. Wrap it in a shell script, easier to read and grow than a on

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Asun Friere
On Aug 19, 2:37 am, "Stephen Cattaneo" <[EMAIL PROTECTED]> wrote: > - What did you run in the cronjob to get back all those variables? > > set; echo "-"; echo "import os; print > os.environ" | python > > Cheers, > > S As I should have noted from $BASH_EXECUTION_STRING. I'd be hal

RE: Python does not get environment variable when using cron.

2008-08-18 Thread Stephen Cattaneo
PM - To: python-list@python.org - Subject: Re: Python does not get environment variable when using cron. - - On Aug 18, 11:15 am, "Stephen Cattaneo" - <[EMAIL PROTECTED]> wrote: - > Hello all, - > - > I am attempting to execute an automated test (written in Python) via - > cron

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Shawn Milochik
Here's a more "English" version of what people are trying to explain: When you log into a Unix session, certain files in your home directory are read and add environment variables to your session. When you run a cron job, it does not do this. It still runs as "you" as far as permissions go, but it

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Edwin . Madari
9:39 PM To: python-list@python.org Subject: Re: Python does not get environment variable when using cron. I'm not sure about the environment variable, but os.uname() should give you what you need otherwise. -- http://mail.python.org/mailman/listinfo/python-list The information contain

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Maric Michaud
Le Monday 18 August 2008 07:11:59 Cameron Simpson, vous avez écrit : > You're probably confused by the fact that cron does not invoke "login" > shells (with their associated initialisation from /etc/profile and > $HOME/.profile). This can be solved by invoking /bin/bash -l -c ..., the -l option fo

Re: Python does not get environment variable when using cron.

2008-08-17 Thread Cameron Simpson
On 17Aug2008 21:25, John Nagle <[EMAIL PROTECTED]> wrote: > Stephen Cattaneo wrote: >> I am attempting to execute an automated test (written in Python) via >> cron. I have to check the HOSTNAME variable as part of the test, oddly >> under cron the HOSTNAME environment variable is not in the os.env

Re: Python does not get environment variable when using cron.

2008-08-17 Thread John Nagle
Stephen Cattaneo wrote: Hello all, I am attempting to execute an automated test (written in Python) via cron. I have to check the HOSTNAME variable as part of the test, oddly under cron the HOSTNAME environment variable is not in the os.environ dictionary. I know that cron runs in a subshell t

Re: Python does not get environment variable when using cron.

2008-08-17 Thread Asun Friere
On Aug 18, 11:15 am, "Stephen Cattaneo" <[EMAIL PROTECTED]> wrote: > Hello all, > > I am attempting to execute an automated test (written in Python) via > cron. I have to check the HOSTNAME variable as part of the test, oddly > under cron the HOSTNAME environment variable is not in the os.environ

Re: Python does not get environment variable when using cron.

2008-08-17 Thread John Machin
On Aug 18, 11:38 am, "Eric Wertman" <[EMAIL PROTECTED]> wrote: > I'm not sure about the environment variable, but os.uname() should > give you what you need otherwise. As documented, it should but may not ... consider using socket.gethost* -- http://mail.python.org/mailman/listinfo/python-list

Re: Python does not get environment variable when using cron.

2008-08-17 Thread Eric Wertman
I'm not sure about the environment variable, but os.uname() should give you what you need otherwise. -- http://mail.python.org/mailman/listinfo/python-list

Python does not get environment variable when using cron.

2008-08-17 Thread Stephen Cattaneo
Hello all, I am attempting to execute an automated test (written in Python) via cron. I have to check the HOSTNAME variable as part of the test, oddly under cron the HOSTNAME environment variable is not in the os.environ dictionary. I know that cron runs in a subshell that does not have all of t