win32com (VBScript to Python) problem

Tim Golden tim.golden at viacom-outdoor.co.uk
Tue Nov 25 07:40:57 EST 2003


> I'm (very non expert) trying to use a snippet of VBScript (to 
> shut down
> Windows workstations) converted to Python but have hit a problem.
> 
> 
> The VBScript below work fine;

[... snip VB script culminating in obj.Win32shutdown 12 ...]

> but my translation results in "'int' object is not callable" with the
> attempted call to Win32Shutdown.

[... snip Python translation of same ...]

I'm not going to attempt to describe what you need to do to send WMI
 methods and parameters back and forth, because it's a pain in the neck,
 which is why I hid all the hard work under the covers here:

http://tgolden.sc.sabren.com/python/wmi.html

and can even offer a comparable example here:

http://tgolden.sc.sabren.com/python/wmi_cookbook.html
(search for "Reboot a remote machine" -- I really must put anchors on that
page)

If you follow that example, all you need to change is the final line
 to read something like:

os.Win32Shutdown (Flags=12)

and it works! (Well, it did for me, anyway).

HTH
Tim

PS If you read the source of the module you'll understand why I
 didn't want to try to explain how it works. Feel free to tinker
 and offer improvements. TJG


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________





More information about the Python-list mailing list