[Tutor] python at boot time

Michael Lange klappnase at freenet.de
Fri Jan 23 22:24:08 EST 2004


On Fri, 23 Jan 2004 17:08:10 -0800 (PST)
helena bhaska <helena_b2001 at yahoo.com> wrote:

> Hi,
> I wrote a python program that I would like to start
> running at boot time.  I tried adding a line like
> this:
> python program.py & 
> to rc.local - however that doesn't work.  What is the
> correct way to do this?
> Thanks!
> 
Hi Helena,

I guess the problem might be that your PATH has not been set when rc.local runs.
In this case try:

/usr/bin/python path-to-program.py &

instead (or the actual path to your python executable if it is not /usr/bin/python of course) .

I personally would prefer to put a #!/usr/bin/env python at the top of the script
and make it executable, so I could call it with just 

path-to-program.py &

(but that's probably just a matter of taste).

I hope this helped

Michael



More information about the Tutor mailing list