VirtualBox COM interface with python
Posted: 16. Jun 2012, 17:45
Hi, I installed the latest of VirtualBox 4.1.16, python 2.7.3 (http://www.python.org/getit/) and win32 extensions (http://sourceforge.net/projects/pywin32 ... ild%20217/) and I am trying to access the host information.
So I type in the following in python:
Ok, so it can't find the enum, so I just try an give it a number, which probably shouldn't work, but whatev. And I get:
COMObject <unknown>? So I look at my objects:
Host is of an unknown object type and is probably why it can't find findHostNetworkInterfacesOfType, I think.
Does anyone else have experience with this?
So I type in the following in python:
Code: Select all
>>> import win32com.client
>>> VirtualBox = win32com.client.Dispatch("VirtualBox.VirtualBox")
>>> Host=VirtualBox.host
>>> Host.findHostNetworkInterfacesOfType(HostNetworkInterfaceType_Bridged, list)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'HostNetworkInterfaceType_Bridged' is not definedCode: Select all
>>> Host.findHostNetworkInterfacesOfType(0, list)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<COMObject <unknown>>", line 2, in findHostNetworkInterfacesOfType
TypeError: Objects of type 'type' can not be converted to a COM VARIANTCode: Select all
>>> VirtualBox
<COMObject VirtualBox.VirtualBox>
>>> Host
<COMObject <unknown>>
Does anyone else have experience with this?