[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
is:


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
->http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wm
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


    pythoncom.CoInitialize()
    #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:

http://sourceforge.net/tracker/index.php?func=detail&aid=1080387&group_id=54
70&atid=105470

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

    http://python.org/2.4/bugs.html


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
http://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list