[IronPython] How would you use IronPython with WMI?
Andy Shah
andy at msistone.com
Sat Aug 28 01:40:42 CEST 2004
How does one use IronPython with WMI ?
I have a short code gleaned from a website
http://www.c-sharpcorner.com/Code/2004/March/WMIEventDetecting.asp
converted to python
from System.Management.Instrumentation import *
f = TestWMI.ROOT.CIMV2.Printer("Canon-Import")
MessageBox.Show(p.Caption)
MessageBox.Show(p.HorizontalResolution.ToString())
MessageBox.Show(p.VerticalResolution.ToString())
... and it does not work.... this is the error i am getting...
Unhandled Exception: IronPython.Objects.PythonAttributeError: 'package#' object
has no attribute 'Management'
at IronPython.Objects.Ops.GetAttr(Object o, String name)
at IronPython.Objects.Importer.ImportFrom(Object mod, String name)
at IronPython.Objects.Importer.ImportOne(String fullName, Boolean keepTop)
at IronPython.Objects.module.Import(String fullName, Boolean keepTop)
at IronPython.Objects.Ops.ImportStar(module mod, String fullName)
at __main__.init() in C:\ip\examples\test.py:line 1
at IronPythonConsole.IronPython.DoFile(String[] args)
at IronPythonConsole.IronPython.Main(String[] args)
What should i do to get WMI working for IronPython?
Kind Regards,
Andy.
More information about the Ironpython-users
mailing list