On Thu, 17 Jul 2008, John Fouhy wrote: > tasklist is the Windows version of ps. You could try something like > 'tasklist /FI "IMAGENAME eq python.exe"', though you'd then have to > parse the output.
Thanks! I just found that too! (Alan's suggestiom made me thing of googling for "ps equivalent memory", and I found a reference to tasklist. It's kludgy, but I have a proof-of-concept that only works if there's only one instance of Python running: def memusage(): import os cmd = 'tasklist /fi "IMAGENAME eq python.exe" /FO table /nh' output = os.popen(cmd).read() processdata = output.split() assert len(processdata) == 6 memsizeK_str = processdata[4] memsizeK_str = memsizeK_str.replace(',','') # get rid of commas return int(memsizeK_str)*1024 The obvious thing to do is to also filter by PID, which is the second element; Of course that opens a new question: how to find one's own PID from within Python. More googling awaits..... _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor