Running a python program during idle time only

los carlos80 at gmail.com
Mon May 23 13:32:18 EDT 2005


Thanks for all the replies.

I did try using nice under windows.  I created a java program that
would just loop and print numbers on the screen.  Even when I ran that
simple program with nice, (lets call it program A) as soon as I started
the program the cpu went all the way to 100% usage.  Then when I ran
another program that did the same thing (lets call it program B),
program A halted to let B finish, then it started again.  Nevertheless
it still hogged all the cpu while I was using the computer.

For my indexing program I just wrote a simple python program and called
on the python os.walk() method to iterate through the drive and then it
connects to a database to store some information.  Then I wrote a
simple interface to connect to the database to search for files using
visual basic.  Once everything is indexed it works fine, but it would
be nice to have the program looping through and indexing the files all
the time to account to file updates, deletes, and relocation, but
without hurting the performance when I'm using the computer.

So really what I am looking for is some way to have the program only
start indexing and crawling through the hd after 5 minutes of no user
interaction with the computer.

I'm going to take a look at this CPU load possibility.  But I'm afraid
that this will work similarly to "nice" in which case it will let the
program kick in when the CPU isn't being used heavily, but I might
still be using the computer.  

thanks once again!

-los




More information about the Python-list mailing list