(Win32) Lowering current process's priority

David Bolen db3l at fitlinxx.com
Mon Sep 25 20:36:53 CEST 2000

Jonathan Epstein <Jonathan_Epstein at nih.gov> writes:

> In general, I have had trouble finding suitable documentation for
> win32pdhutil, win32con, and win32api, in constrast to the excellent
> documentation for the standard (non-win32) python libraries.  Can anyone
> recommend some suitable online sources?

Try: http://msdn.microsoft.com/library/default.asp

The win32 extension wrappings are around standard Win32 calls, so you
can pretty much use the actual Win32 API reference information.  The
online help provided with the extensions are most useful to see how
the parameters have been interfaced with Python where there is any
wiggle room.  If you've got a local MSDN subscription, that works
great too (and without needing web access).

With respect to your problem case:

> win32api.SetPriorityClass(win32api.GetCurrentProcessId(),
>                           win32con.IDLE_PRIORITY_CLASS)

The attribute error is probably because SetPriorityClass is wrapped
within the win32process module, not win32api.

Also, SetPriorityClass' first parameter is a handle, not the numeric
process id, so you want to use GetCurrentProcess() not

The following should work:

    import win32api
    import win32process
    import win32con


(at least it did in my quick tests)

-- David
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \

More information about the Python-list mailing list