Opened 6 years ago
#18366 new defect
Can't use vboxapi on Mac using Python bindings with anything other than the system version of Python
Reported by: | keeely | Owned by: | |
---|---|---|---|
Component: | other | Version: | VirtualBox 6.0.2 |
Keywords: | sdk python | Cc: | |
Guest type: | other | Host type: | Mac OS X |
Description
Version 6.0.2 r128162 (Qt5.6.3)
When I installed VirtualBox it seems to have setup Python bindings to the system Python version on Mojave of 2.7.10.
I have installed the sdk for python 2.7.15 and 3.7 with: cd /Applications/VirtualBox.app/Contents/MacOS/sdk/installer sudo VBOX_INSTALL_PATH=/Applications/VirtualBox.app/Contents/MacOS /usr/local/bin/python2 vboxapisetup.py install sudo VBOX_INSTALL_PATH=/Applications/VirtualBox.app/Contents/MacOS python3 vboxapisetup.py install
The installation appears to complete correctly for both python2.7.15 and python3.7.0. However my test program only works for the built-in python 2.7.10 (/usr/bin/python).
My test Python program is:
from vboxapi import VirtualBoxManager mgr = VirtualBoxManager(None, None)
On built-in Mojave Python version, execution is without error (/usr/bin/python test.py)
On brew-installed Python 2 (/usr/local/bin/python2 test.py), I get: Segmentation fault: 11
On python 3.7.0 (python3 test.py) get: m=VBoxPython3_7m x=No module named 'VBoxPython3_7m' m=VBoxPython3m x=No module named 'VBoxPython3m' m=VBoxPython x=No module named 'VBoxPython' Traceback (most recent call last):
File "test.py", line 2, in <module>
mgr = VirtualBoxManager(None, None)
File "/usr/local/lib/python3.7/site-packages/vboxapi/init.py", line 989, in init
self.platform = PlatformXPCOM(dPlatformParams)
File "/usr/local/lib/python3.7/site-packages/vboxapi/init.py", line 750, in init
import xpcom.vboxxpcom
File "/Applications/VirtualBox.app/Contents/MacOS/sdk/bindings/xpcom/python/xpcom/vboxxpcom.py", line 78, in <module>
raise Exception('Cannot find VBoxPython module (tried: %s)' % (', '.join(_asVBoxPythons),))
Exception: Cannot find VBoxPython module (tried: VBoxPython3_7m, VBoxPython3m, VBoxPython)