On Mon, 2025-03-24 at 20:32 +0800, James Liu via vbox-dev wrote: > Hi, > > I got two problems of using VirtualBox SDK in Python. > > Environment: Centos8.5, Ubuntu22.04 > Platform: x86-64 > VirtualBox version: 7.1 > Installation: sudo apt-get install virtualbox (dnf install for > Centos) > > > There are several environment variables set. > - VBOX_SDK_PATH: /usr/lib/virtualbox > - VBOX_INSTALL_PATH: /usr/lib/virtualbox > > 1. When installing Python binding with ```python3 vboxapisetup.py > install```, there is an error: > > m=VBoxPython3_10 x=dynamic module does not define module export > function (PyInit_VBoxPython3_10) > Traceback (most recent call last): > ... > if oHost.architecture not in > (oVBoxMgr.constants.PlatformArchitecture_x86, > File > "/usr/lib/virtualbox/sdk/bindings/xpcom/python/xpcom/client/__init__. > py", line 391, in __getattr__ > raise AttributeError("XPCOM component '%s' has no attribute '%s'" > % (self._object_name_, attr)) > AttributeError: XPCOM component '<unknown>' has no attribute > 'architecture'
I think you need locate [1] which is module xpcom /usr/lib/virtualbox/VBoxPython3.so /usr/lib/virtualbox/VBoxPython3m.so > Despite the error, I can still use Python API. > > 2. With above installation, single threading is ok to use, but for > multithreading or multiprocessing, it reports an error "No module > named xpcom". VBoxXPCOM.so is located at /usr/lib/virtualbox. > > > Any suggestion is appreciated. Thanks! > > > Sample code: > > import virtualbox > from multiprocessing.pool import Pool > > vm_names = ["vm1", "vm2", "vm3"] > pool = Pool(processes=len(vm_names)) > > def vm_func(vm_name): > vb = virtualbox.VirtualBox() # error: no module named 'xpcom' > > pool = Pool(3) > for name in vm_names: > pool.apply_async(func=vm_func, args=(name,)) > -- Sérgio M. B.
_______________________________________________ vbox-dev mailing list vbox-dev@virtualbox.org https://www.virtualbox.org/mailman/listinfo/vbox-dev