yabune
March 22nd, 2010, 03:12 PM
Hi,
I'm new to python and I did a small script that I would like to start when I login. This script has an infinite loop and I would like that it would to keep running when I'm logged in.
Now I have 2 questions:
1) How can I start it in the background? I add this line to .basrc:
python myscript.py
but the problem is that when I open a terminal window, the bash is locked in the script loop. I have to press CTRL+C to be able to write in the console window.
2) What's the best way to create an infinite loop in python? I did like this:
while True:
do_something();
time.sleep(0.1);
Is this the best way? To have a sleep function?
Thank you!
I'm new to python and I did a small script that I would like to start when I login. This script has an infinite loop and I would like that it would to keep running when I'm logged in.
Now I have 2 questions:
1) How can I start it in the background? I add this line to .basrc:
python myscript.py
but the problem is that when I open a terminal window, the bash is locked in the script loop. I have to press CTRL+C to be able to write in the console window.
2) What's the best way to create an infinite loop in python? I did like this:
while True:
do_something();
time.sleep(0.1);
Is this the best way? To have a sleep function?
Thank you!