Re: [python-win32] Merge of py3k branch complete!

2009-01-29 Thread Michel Claveau
I'm very happy to declare the merge of Roger's py3k branch 'complete' Thanks very much to Jason, Mark, Roger, Vern (alphabetic sort) and all contributors to PyWin32 (for Python 3.0 and others). Pywin32 is the best tool of all times, for the best language of all ages. (just a little

Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-29 Thread Steven James
For the display of bitmaps, most apps take the approach of creating (sometimes multiple) low-res versions of the images, then swapping out so that only what you need at the moment is loaded in to memory. For instance, create a 50x50 version, a 100x100 version, and a 500x500 version. Only load the

Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-29 Thread Vernon Cole
Geoff: Congratulations, you have just provided an excellent example of Nathan's first law: *Software is a gas* Software always expands to fit whatever container it is stored in. http://www.codinghorror.com/blog/archives/000677.html -- VC On Thu, Jan 29, 2009 at 5:18 AM, Steven James

[python-win32] Opening and enumerating resource many times

2009-01-29 Thread Gustavo Tabares
Hi all, I'm having a problem when opening and enumerating a network resource many times. For example: i = 0 while i 1: handle = win32wnet.WNetOpenEnum(win32netcon.RESOURCE_CONNECTED, win32netcon.RESOURCETYPE_ANY, 0, None) partial_nr_list = win32wnet.WNetEnumResource(handle)

Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-29 Thread Tim Roberts
geoff wrote: I am hoping someone could steer me in the right direction on how to calculate the amount of RAM available to a process. I found the post below from Tim Roberts - a belated thanks Tim for your patient responses ! and it seems we regularly hit this limit. We have an application

Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-29 Thread geoff
There's no easy fix. Thumbnails and some kind of least-recently-used caching scheme are probably your best choices. As Steven pointed out, you could always install a Win64 system and a 64-bit Python. Then, you can get about 8TB of process space. However, that's not particularly friendly

Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-29 Thread Steven James
Not an expert on this, but googling win32 performance counters led me here: http://msdn.microsoft.com/en-us/library/aa373193(VS.85).aspx Should let you get the available physical memory in the system. Not sure that you can specify to Windows that you want physical memory when you create the image

Re: [python-win32] Opening and enumerating resource many times

2009-01-29 Thread Tim Roberts
Gustavo Tabares wrote: Hi all, I'm having a problem when opening and enumerating a network resource many times. For example: i = 0 while i 1: handle = win32wnet.WNetOpenEnum(win32netcon.RESOURCE_CONNECTED, win32netcon.RESOURCETYPE_ANY, 0, None) partial_nr_list =

Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-29 Thread Tim Roberts
geoff wrote: Any tips/hints on calculating the potentially available space ? Do you mean the total amount of process virtual memory space still available? You can actually get that from the GlobalMemoryStatusEx API. There's no Python wrapper for that, as far as I know, but here's a ctypes

Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-29 Thread Tim Roberts
Steven James wrote: Not an expert on this, but googling win32 performance counters led me here: http://msdn.microsoft.com/en-us/library/aa373193(VS.85).aspx http://msdn.microsoft.com/en-us/library/aa373193%28VS.85%29.aspx Should let you get the available physical memory in the system. Not

Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-29 Thread Steven James
Agreed, but PDH can give per-process statistics, too. For high-memory-usage apps, I would think that it would be nice for your app to know whether it is *likely* to need to swap out (by comparing needed memory to availably physical memory). Anyway, using the same API, you can determine how much

Re: [python-win32] Opening and enumerating resource many times

2009-01-29 Thread Mark Hammond
On 30/01/2009 5:09 AM, Gustavo Tabares wrote: Hi all, I'm having a problem when opening and enumerating a network resource many times. For example: i = 0 while i 1: handle = win32wnet.WNetOpenEnum(win32netcon.RESOURCE_CONNECTED, win32netcon.RESOURCETYPE_ANY, 0, None)

[python-win32] Pb SxS for install

2009-01-29 Thread Michel Claveau
Hi! When I try to install pywin32-212.6.win32-py2.6.exe, I had a SideBySide error. Below, the complete message found in the journal of applications. Any idea, for solution ? Thanks in advance. -- Michel Claveau -- Nom du journal

Re: [python-win32] Pb SxS for install

2009-01-29 Thread Mark Hammond
On 30/01/2009 10:54 AM, Michel Claveau wrote: Hi! When I try to install pywin32-212.6.win32-py2.6.exe, I had a SideBySide error. Below, the complete message found in the journal of applications. Any idea, for solution ? Thanks in advance. Oops! It appears that in the process of applying

Re: [python-win32] Pb SxS for install

2009-01-29 Thread Michel Claveau
Re, It shouldn't be possible for me to make this mistake again as the distutils patches are now checked into Python's SVN, and please let me know if this fixes the problem. OK, but... over night, after a (good ? long?) sleep (with several dreams, where Pywin32 run without problem of DLL

Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-29 Thread geoff
from ctypes import * from ctypes.wintypes import * class MEMORYSTATUSEX(Structure): _fields_ = [ ('dwLength', DWORD), ('dwMemoryLoad', DWORD), ('ullTotalPhys', c_ulonglong), ('ullAvailPhys', c_ulonglong), ('ullTotalPageFile', c_ulonglong),

Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-29 Thread Tim Roberts
geoff wrote: There does appear to be this win32api.GlobalMemoryStatusEx(). It wasn't in mine (I checked there first!), but I am a couple of releases behind. In monitoring my system before and after the process crashed, it yielded this result below - it is supposed to be a table, but I

Re: [python-win32] How to calc amount of avail RAM in a process ?

2009-01-29 Thread geoff
I would caution you not to draw any conclusions based on the physical numbers. You WANT your system to be using all of its physical memory. Unused physical memory is just wasted money. The operating system will page things in and out as needed, on a demand basis, to make sure that pages