Thanks, I'll try this out!

Guillaume Proux wrote:
Hi Astan,

Astan Chee <stanc <at>> writes:
Im using py2exe to convert my python scripts to .exe. Im trying to get 
my scripts and .exes to only run (utilize full CPU) when my PC is idle 
(kinda like SETI <at> home).

The first step would be to change the priority of your software to run at the
lowest priority class of Windows. The simplest way to do that for me was to make
the following calls

from ctypes import windll
myprocess = windll.kernel32.GetCurrentProcess()
windll.kernel32.SetPriorityClass(myprocess,0x00000040) #0x00000040 =

I just tried that code with an infinite loop (that usually uses 100% of CPU and
makes the machine unusable...) and I am writing this email while it runs in the
background without any obvious lag.

If this is not enough, you can probably (don't know how but...) find out about
the CPU activity and check CPU activity for a while before you decide to go
about and do your CPU crunching activities.



This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
Py2exe-users mailing list