NS_ERROR_NO_INTERFACE
ENVIRONMENT
- Operating System: archlinux
- Python version: Python 3.9.0 (default, Oct 7 2020, 23:09:01) [GCC 10.2.0] on linux
- VirtualBox version: 6.1.16-3
- VirtualBox SDK version: 6.1.16-3
- virtualbox-python / pyvbox version:2.1.1
>>> import virtualbox
>>> vbox = virtualbox.VirtualBox()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/manuel/.local/lib/python3.9/site-packages/virtualbox/library_ext/vbox.py", line 22, in __init__
manager = virtualbox.Manager()
File "/home/manuel/.local/lib/python3.9/site-packages/virtualbox/__init__.py", line 163, in __init__
self.manager = vboxapi.VirtualBoxManager(mtype, mparams)
File "/usr/lib/python3.9/site-packages/vboxapi/__init__.py", line 989, in __init__
self.platform = PlatformXPCOM(dPlatformParams)
File "/usr/lib/python3.9/site-packages/vboxapi/__init__.py", line 752, in __init__
import xpcom.components
File "/usr/lib/virtualbox/sdk/bindings/xpcom/python/xpcom/components.py", line 240, in <module>
_shutdownObserver = xpcom.server.WrapObject(_ShutdownObserver(), interfaces.nsIObserver)
File "/usr/lib/virtualbox/sdk/bindings/xpcom/python/xpcom/server/__init__.py", line 64, in WrapObject
return _xpcom.WrapObject(policy( ob, iid ), iid, bWrapClient)
File "/usr/lib/virtualbox/sdk/bindings/xpcom/python/xpcom/server/policy.py", line 161, in __init__
raise ServerException(nsError.NS_ERROR_NO_INTERFACE)
xpcom.ServerException: 0x80004002 (NS_ERROR_NO_INTERFACE)
Same problem here on an up-to-date Arch Linux and virtualbox==2.1.1
Fix for me (BUT I DONT KNOW WHAT I'M DOING): make two comments in /usr/lib/virtualbox/sdk/bindings/xpcom/python/xpcom/server/policy.py
root@linbox:server git diff policy.py.org policy.py
diff --git a/policy.py.org b/policy.py
index 7f84167..b36a304 100644
--- a/policy.py.org
+++ b/policy.py
@@ -157,8 +157,8 @@ class DefaultPolicy:
delegate_qi = getattr(instance, "_query_interface_", None)
# Perform the actual QI and throw away the result - the _real_
# QI performed by the framework will set things right!
- if delegate_qi is None or not delegate_qi(iid):
- raise ServerException(nsError.NS_ERROR_NO_INTERFACE)
+ #if delegate_qi is None or not delegate_qi(iid):
+ # raise ServerException(nsError.NS_ERROR_NO_INTERFACE)
# Stuff for the magic interface conversion.
self._interface_info_ = None
self._interface_iid_map_ = {} # Cache - Indexed by (method_index, param_index)
root@linbox:server
Same problem on Python 3.9.2, Ubuntu 20.04, Virtualbox 6.1.26, virtualbox python 2.1.1. Commenting the lines @kmille mentioned worked for me too. Things (I wanted to work) are still working nonetheless. It was definitely working before on Python 3.8 on my setup, with the same Virtualbox SDK as far as I remember.
same for me using vbox 6.1.26 - python 3.9.7 - Ubuntu 20.10, @kmille solution works, thanks!