Closed d4l3k closed 1 year ago
Does this package work for Virtualbox 6.X?
Not currently, would have to rebuild library.py with the latest API definition.
Not currently, would have to rebuild library.py with the latest API definition.
What verison of VirtualBox is working with package?
Latest 5.x, working on 6.0 now.
I can't reproduce this on my machine, callback is working successfully.
same error when trying:
virtualbox.events.register_callback(callback, vm.session.console.event_source, VBoxEventType.on_vrde_server_info_changed)
But i think problem here:
events.py
def _event_monitor(callback, event_source, listener, event_interface, quit):
global _callbacks
try:
while not quit.is_set():
try:
event = event_source.get_event(listener, 1000)
except library.VBoxError:
print("Unregistering %s due to VBoxError on get_event" %
listener, file=sys.stderr)
break
if event:
try:
callback(event_interface(event))
except Exception:
print("Unhanded exception in callback: \n%s" %
traceback.format_exc(), file=sys.stderr)
event_source.event_processed(listener, event)
because get_event method from vbox sdk return null/none if available https://www.virtualbox.org/sdkref/interface_i_event_source.html#acfc3baef025a16a35ce0859b42c03077
and here need to replace:
library.py
def get_event(self, listener, timeout):
"""
...
"""
not isinstance(listener, IEventListener):
TypeError("listener can only be an instance of type IEventListener")
if not isinstance(timeout, baseinteger):
TypeError("timeout can only be an instance of type baseinteger")
event = self._call("getEvent", in_p=[listener, timeout])
# event = IEvent(event)
# return event
return IEvent(event) if event else None
And now all works fine for me
@KarloDipetrio Could you submit a PR? I have less and less time to work on this project unfortunately.
ok, no problem!
@sethmlarson Done! And thank you so much for this library =)
I no longer have time to maintain this library, so am closing this issue.
ENVIRONMENT
master
branch?SUMMARY
register_key_callback doesn't work correctly and throws an exception when trying to run the callback. It also causes the VBox VM to close.
There's also an exception that happens while handling the exception (which looks like a python3 compatibility issue).
STEPS TO REPRODUCE
EXPECTED RESULTS
It should log key events as they happen.
ACTUAL RESULTS
throws an error