Note that there are some explanatory texts on larger screens.

plurals
  1. POWMI querying issues in Python
    text
    copied!<p>I've recently been working on a Squish test script, and trying to do something like what's described in the solution at: <a href="https://stackoverflow.com/questions/938733/python-total-memory-used/938800#938800">Total memory used by Python process?</a></p> <p>The relevant snippets from my code are as follows:</p> <pre><code>def measureMemory(): w = wmi.WMI('.') result = w.query("SELECT WorkingSet FROM Win32_PerfRawData_PerfProc_Process WHERE Name=\"some_program\"") print result for WorkingSet in result: print WorkingSet subset = result[0] print subset['WorkingSet'] # return result[0]['WorkingSet'] for i in range(50): memory = measureMemory() if memory: # test.passes("%d memory used during undo." % memory) print memory </code></pre> <p>Unfortunately, I've run into an error whenever I actually try to run the thing, as can be seen below.</p> <pre><code>[&lt;_wmi_object: \\USER-PC\root\cimv2:Win32_PerfRawData_PerfProc_Process.Name="some_program"&gt;] instance of Win32_PerfRawData_PerfProc_Process { Name = "some_program"; WorkingSet = "19386368"; }; Traceback (most recent call last): File "C:\Python26\Test scripts\Testify", line 25, in -toplevel- memory = measureMemory() File "C:\Python26\Test scripts\Testify", line 19, in measureMemory print subset['WorkingSet'] File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 242, in __getitem__ raise TypeError("This object does not support enumeration") TypeError: This object does not support enumeration </code></pre> <p>I'm not sure why this should be throwing an error, as I don't think I've changed anything significant from the example I took code from. I'm using Python 2.4.4, if that's significant, and unfortunately I can't really upgrade, no matter how much it might help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload