On Sun, Oct 7, 2012 at 4:14 AM, Jason Friedman wrote:
>> The only canned solution for parsing a bash script is bash. Think
>> about it the other way around: If you wanted to have a Python variable
>> made available to a bash script, the obvious thing to do is to invoke
>> Python. It's the same thi
> The only canned solution for parsing a bash script is bash. Think
> about it the other way around: If you wanted to have a Python variable
> made available to a bash script, the obvious thing to do is to invoke
> Python. It's the same thing.
I scratched my own itch:
http://code.activestate.com/r
On Wed, Oct 3, 2012 at 1:49 PM, Jason Friedman wrote:
> 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.
The only canned solution for parsi
> 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 opt
On Tuesday, 2 October 2012 21:34:04 UTC+5:30, xDog Walker wrote:
> On Monday 2012 October 01 08:35, Hans Mulder wrote:
>
> > AFAIK, there is no Python module that can read shell syntax.
>
>
>
> The stdlib's shlex might be that module.
>
>
>
> --
>
> Yonder nor sorghum stenches shut ladle
On Monday 2012 October 01 08:35, Hans Mulder wrote:
> AFAIK, there is no Python module that can read shell syntax.
The stdlib's shlex might be that module.
--
Yonder nor sorghum stenches shut ladle gulls stopper torque wet
strainers.
--
http://mail.python.org/mailman/listinfo/python-list
On 1/10/12 16:12:50, Jason Friedman wrote:
>> I want my python 3.2.2 script, called via cron, to know what those
>> additional variables are. How?
>
> Thank you for the feedback. A crontab line of
>
> * * * * * . /path/to/export_file && /path/to/script.py
>
> does indeed work, but for various
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 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 dicti
On Tue, Oct 2, 2012 at 12:37 AM, Jason Friedman 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'
>
On Tue, Oct 2, 2012 at 12:12 AM, Jason Friedman wrote:
> Let me restate my question. I have a file that looks like this:
> export VAR1=foo
> export VAR2=bar
> # Comment
> export VAR3=${VAR1}${VAR2}
>
> I want this:
> my_dict = {'VAR1': 'foo', 'VAR2': 'bar', 'VAR3': 'foobar'}
>
> I can roll my own
> I want my python 3.2.2 script, called via cron, to know what those
> additional variables are. How?
Thank you for the feedback. A crontab line of
* * * * * . /path/to/export_file && /path/to/script.py
does indeed work, but for various reasons this approach will not
always be available to me.
Jason Friedman writes:
[...]
> I want my python 3.2.2 script, called via cron, to know what those
> additional variables are. How?
This is not a python question. Have a look at the crontab(5) man page,
it's all explained there.
-- Alain.
--
http://mail.python.org/mailman/listinfo/python-list
Am 01.10.2012 02:11, schrieb Jason Friedman:
$ crontab -l
* * * * * env
This produces mail with the following contents:
[...]
SHELL=/bin/sh
^^^
[...]
On the other hand
$ env
produces about 100 entries, most of which are provided by my .bashrc;
bash != sh
Instead of running
On Mon, Oct 1, 2012 at 10:11 AM, Jason Friedman wrote:
> $ env
>
> produces about 100 entries, most of which are provided by my .bashrc;
> cron provides only a limited number of environment variables.
>
> I want my python 3.2.2 script, called via cron, to know what those
> additional variables are
On Sun, 30 Sep 2012 18:11:09 -0600, Jason Friedman wrote:
> $ crontab -l
> * * * * * env
>
> This produces mail with the following contents:
[snip]
Yes, env returns the environment variables of the current environment.
> On the other hand
>
> $ env
>
> produces about 100 entries, most of whi
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
On the other hand
$ env
produces about 100 entries, most of which are provided by my .bashrc;
cron provid
17 matches
Mail list logo