[Tutor] Win32 Question

Gooch, John John.Gooch at echostar.com
Wed Jun 1 21:00:41 CEST 2005

I am not sure if there is a better list to ask this question on, but here it

I have a Python script that works fine for accessing WMI ( Windows
Management Interface ) class properties, but it does not let me access any
of their methods. The code below works fine with Win32_Process objects
unless I try execute a method ( such as 'GetUser' ). Here is a link to
Microsofts documentation
i/wmi_tasks__processes.asp if that helps.   

Below is my code, the error I get on the 'GetOwner' line is - TypeError:
'int' object is not callable     - :

import threading
import time
import Queue
#import ping
#rom mx import ODBC
import odbc
import socket
import re
import win32com.client
import win32api
import win32con
import win32file
import pythoncom
import datetime
import os

    #connect to localhost wmi service
    wmi = win32com.client.GetObject('winmgmts://' )
    wtprocs = {}#create empty dictionary
    results = wmi.execQuery( "SELECT name,processid,usermodetime FROM
WIN32_Process WHERE name='saclient.exe'" )
    for process in results:
        #tsecs = int( float(process.KernelModeTime) +
float(process.UserModeTime )/10000000 ) 
        name = process.name
        pid = process.processid
        tsecs = int( float( process.UserModeTime )/10000000.00  )
        #if ( tsecs >= 10800 ):
        #owner = os.system("c:\batch2000\kill.exe " + process.processid)
        owner = ""
        domain = ""
      this line causes the error given above -----> process.GetOwner()
        #apply( process.GetOwner )
        print "Process %s (id %d owner %s ) has been running %d hours" % (
process.name,process.processid,owner,int(tsecs/3600) )

-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On Behalf
Of Danny Yoo
Sent: Wednesday, June 01, 2005 11:13 AM
To: Jeff Peery
Cc: tutor at python.org
Subject: Re: [Tutor] IDLE not working?

On Wed, 1 Jun 2005, Jeff Peery wrote:

> Hello, I upgraded python to 2.4 and now my IDLE isn't working. There 
> is an error indicating something is wrong with my configuration file 
> for the IDLE settings. Any suggestions for how to solve this problem 
> would be much appreciated. thanks.

Hi Jeff,

This looks like bug 1080387 in SF:


It's also listed as a bug in the BUGS page:


Removing the '.idlerc' subdirectory in your home directory should force IDLE
to restore default font settings.

Best of wishes to you!

Tutor maillist  -  Tutor at python.org

More information about the Tutor mailing list