Closed dickreuter closed 7 years ago
The reason that the IConsole
object doesn't have a display
attribute is not because it doesn't actually not have that attribute but rather that the session's console object isn't an active console with the virtual machine running. Try starting the VM via launch_vm_process()
and try this again with the resulting session object.
import virtualbox vbox = virtualbox.VirtualBox() print("VM(s):\n + %s" % "\n + ".join([vm.name for vm in vbox.machines])) vm = vbox.find_machine('Windows') session = vm.createsession() h, w, , , , _= session.console.display.get_screen_resolution(0) png = session.console.display.take_screen_shot_png_to_array(0, h, w)
gives the follwing error:
raise AttributeError("Failed to find attribute %s in %s" % (name, self)) AttributeError: Failed to find attribute display in <virtualbox.library_ext.console.IConsole object at 0x00000237D28EE710> Win32 exception occurred releasing IUnknown at 0xd2ac9730