[python-win32] fast test if (unknown) process is running ? Why not use Autoit ?

2010-08-06 Thread Stef Mientki
hello, I wonder if there's a fast way to test if a process is running. these are my experiences till so far: 1. win32pdh, not usefull, because it shows ths status of some ancient history 2. wmi, VERY SLOW: 1500 .. 2000 msec import wmi w = wmi.WMI() processes = w.instances('Win32_Pro

Re: [python-win32] fast test if (unknown) process is running ? Why not use Autoit ?

2010-08-06 Thread Tim Golden
On 06/08/2010 12:27, Stef Mientki wrote: hello, I wonder if there's a fast way to test if a process is running. these are my experiences till so far: 1. win32pdh, not usefull, because it shows ths status of some ancient history 2. wmi, VERY SLOW: 1500 .. 2000 msec import wmi w = wm

Re: [python-win32] fast test if (unknown) process is running ? Why not use Autoit ?

2010-08-06 Thread Stef Mientki
thanks Tim, On 06-08-2010 13:44, Tim Golden wrote: > On 06/08/2010 12:27, Stef Mientki wrote: > Try psutil (which uses the toolhelp DLL): > > http://code.google.com/p/psutil/ > > > import psutil > > for p in psutil.process_iter (): > if p.name == "blah": > print p > break > else: >

Re: [python-win32] fast test if (unknown) process is running ? Why not use Autoit ?

2010-08-06 Thread sharpblade
You are not using the WMI efficiently. You iterate over every process to test if only one is there, when you can use WMI like so: >>> import wmi >>> x = wmi.WMI() >>> x.query("SELECT * FROM Win32_Process WHERE Name = 'xchat.exe'") [<_wmi_object: \\TOM-PC\root\cimv2:Win32_Process.Handle="7052">] >>

Re: [python-win32] fast test if (unknown) process is running ? Why not use Autoit ?

2010-08-06 Thread Stef Mientki
thanks, On 06-08-2010 15:37, sharpblade wrote: > You are not using the WMI efficiently. You iterate over every process to test > if only one is > there, when you can use WMI like so: > > >>> import wmi > >>> x = wmi.WMI() > >>> x.query("SELECT * FROM Win32_Process WHERE Name = 'xchat.exe'") > [<

Re: [python-win32] fast test if (unknown) process is running ? Why not use Autoit ?

2010-08-06 Thread Tim Golden
On 06/08/2010 8:10 PM, Stef Mientki wrote: thanks, On 06-08-2010 15:37, sharpblade wrote: You are not using the WMI efficiently. You iterate over every process to test if only one is there, when you can use WMI like so: import wmi x = wmi.WMI() x.query("SELECT * FROM Win32_Process WHERE Na

Re: [python-win32] fast test if (unknown) process is running ? Why not use Autoit ?

2010-08-06 Thread Stef Mientki
thanks Tim, On 06-08-2010 21:18, Tim Golden wrote: >> but that looks quit more complicated than psutils, >> besides that I believe that psutils is platform independant. > 0.082446869 > > Well, just to phrase is slightly differently: > > > import wmi > > c = wmi.WMI () > for p in c.Win32_Proc

Re: [python-win32] fast test if (unknown) process is running ? Why not use Autoit ?

2010-08-06 Thread Dahlstrom, Roger
Python-Win32... As in win32 As in windows... :-) - Original Message - From: [email protected] Cc: [email protected] Sent: Fri Aug 06 18:34:55 2010 Subject: Re: [python-win32] fast test if (unknown) process is running ? Why not use Autoi

[python-win32] Compiling python functions in a c file on windows

2010-08-06 Thread David Hutto
While trying to go through the tutorial in the official python documentation, I'm encountering a problem on Windows(ubuntu/linux compiles the same test file fine) I'm just using a 'dummy' function at this point, so no other errors are thrown: #include "c:\\Python31\\include\\Python.h" int main()