Cannot create VirtualBoxManager in Python

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
ikada
Posts: 3
Joined: 31. Mar 2016, 23:03

Cannot create VirtualBoxManager in Python

Post by ikada »

I just installed the Python SDK for VirtualBox and cannot get an instance of VirtualBoxManager without triggering a SIGSEGV.

Code: Select all

from vboxapi import VirtualBoxManager # this works, I can also dir(VirtualBoxManager) and it looks correct
manager = VirtualBoxManager(None, None) # this crashes: 'python main.py' terminated by signal SIGSEGV (Address boundary error)
VirtualBox 5.0.16 (same SDK version)
OS X El Capitan 10.11

Any help appreciated. I'm hoping I just missed a step.

EDIT: I added some trace logging:

Code: Select all

line, /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xpcom/vboxxpcom.py:42
line, /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xpcom/vboxxpcom.py:44
line, /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xpcom/vboxxpcom.py:45
line, /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xpcom/vboxxpcom.py:46
line, /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xpcom/vboxxpcom.py:47
fish: 'python main.py' terminated by signal SIGSEGV (Address boundary error)
Line 47 of vboxxpcom.py:

Code: Select all

_oVBoxPythonMod =  __import__(m)
The value of `m` is "VBoxPython2_7".

EDIT 2:

I can replicate the issue further with:

Code: Select all

import sys
sys.path.append('/Applications/VirtualBox.app/Contents/MacOS')
import VBoxPython2_7
Maybe a permissions error on the directory? Or the VBoxPython2_7.so is in the wrong format?
ikada
Posts: 3
Joined: 31. Mar 2016, 23:03

Re: Cannot create VirtualBoxManager in Python

Post by ikada »

Solved the problem. The VirtualBox SDK is not compatible with the homebrew installation of Python 2.7. It only works with the default installation found on OS X.
Post Reply