Correction, calling it from spyder(a working spyder) doesn't crash. Calling this function from python/ipython does cause a crash
On Tue, May 15, 2012 at 10:29 AM, Matt Anderson <[email protected]> wrote: > However, importing the windows_memory_usage function and calling it > doesn't crash...mine returns 73 > > > On Tue, May 15, 2012 at 10:28 AM, Jed Ludlow <[email protected]> wrote: > >> On Tue, May 15, 2012 at 9:24 AM, Matt Anderson <[email protected]>wrote: >> >>> Jed wins the prize, >>> >>> It looks like this function may not be any good on 64 bit systems (in >>> utils\system.py) >>> >>> def windows_memory_usage(): >>> """Return physical memory usage (float) >>> Works on Windows platforms only""" >>> from ctypes import windll >>> from ctypes.wintypes import byref, Structure, DWORD >>> class MemoryStatus(Structure): >>> _fields_ = [('dwLength', DWORD), ('dwMemoryLoad', DWORD), >>> ('dwTotalPhys', DWORD), ('dwAvailPhys', DWORD), >>> ('dwTotalPageFile', DWORD), ('dwAvailPageFile', >>> DWORD), >>> ('dwTotalVirtual', DWORD), ('dwAvailVirtual', >>> DWORD),] >>> memorystatus = MemoryStatus() >>> windll.kernel32.GlobalMemoryStatus(byref(memorystatus)) >>> return float(memorystatus.dwMemoryLoad) >>> >>> >> Yes, running system.py as a script produces the same interpreter crash. >> Some days ctypes is your friend. Some days it isn't :). >> >> -- >> You received this message because you are subscribed to the Google Groups >> "spyder" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/spyderlib?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "spyder" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
