Opened 10 years ago
Closed 5 years ago
#14012 closed defect (obsolete)
After upgrade to 4.3.26 exception is raised if create second instance of VirtualBoxManager
| Reported by: | odlbo314 | Owned by: | |
|---|---|---|---|
| Component: | VM control | Version: | VirtualBox 4.3.26 |
| Keywords: | Cc: | ||
| Guest type: | Windows | Host type: | Linux |
Description
Hello! After upgrade from virtualbox 4.3.20 to 4.3.26 my code generates errors.
Small example to reproduce error:
#!/usr/bin/env python from vboxapi import VirtualBoxManager VirtualBoxManager(None, None) VirtualBoxManager(None, None)
Output of the script:
init exception: 'NoneType' object has no attribute '__getitem__'
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/vboxapi/__init__.py", line 981, in __init__
self.vbox = self.platform.getVirtualBox()
File "/usr/lib/python2.7/dist-packages/vboxapi/__init__.py", line 735, in getVirtualBox
return xpcom.components.classes["@virtualbox.org/VirtualBox;1"].createInstance()
TypeError: 'NoneType' object has no attribute '__getitem__'
Traceback (most recent call last):
File "./test_script.py", line 5, in <module>
VirtualBoxManager(None, None)
File "/usr/lib/python2.7/dist-packages/vboxapi/__init__.py", line 992, in __init__
raise e
TypeError: 'NoneType' object has no attribute '__getitem__'
Also this exception is raised if create instances of VirtualBoxManager in different Python threads.
Seems this error occurs because method "observe" of class "_ShutdownObserver" from module "xpcom.components" executes and set variable global xpcom.components.classes to None.
Note:
See TracTickets
for help on using tickets.


Hello again! I've recognized following workaround. Seems scripts using python API for virtualbox work normally if I share one copy of VirtualBoxManager between threads.
Btw... Is it normal solution?