[vbox-dev] just trying to start a VM
Frédéric SOSSON
fsosson at gmail.com
Thu Aug 6 15:00:12 GMT 2009
Hello,
I wrote those lines of python code trying to start a VM.
Unfortunatly, I got this messge:
Traceback (most recent call last):
File "./startmyvm.py", line 38, in <module>
startMyMachine()
File "./startmyvm.py", line 32, in startMyMachine
session = mgr.getSessionObject(vb)
File "/usr/lib/python2.6/dist-packages/vboxapi/__init__.py", line
466, in getSessionObject
return self.mgr.platform.getSessionObject(vbox)
AttributeError: 'NoneType' object has no attribute 'getSessionObject'
######################################################################################
#!/usr/bin/python
import os,sys
import traceback
import shlex
import time
from vboxapi import VirtualBoxManager
style = None
g_virtualBoxManager = VirtualBoxManager(style, None)
ctx = {'global':g_virtualBoxManager,
'mgr':g_virtualBoxManager.mgr,
'vb':g_virtualBoxManager.vbox,
'ifaces':g_virtualBoxManager.constants,
'remote':g_virtualBoxManager.remote,
'type':g_virtualBoxManager.type,
'run': lambda cmd,args: runCommandCb(ctx, cmd, args),
'machById': lambda id: machById(ctx,id),
'_machlist':None
}
g_virtualBoxManager.deinit()
del g_virtualBoxManager
def startMyMachine():
mgr = ctx['mgr']
vb = ctx['vb']
# perf = ctx['perf']
# uuid = mach.id
session = mgr.getSessionObject(vb)
uuid = vb.findMachine("Windows_XP_Config_Standard")
progress = vb.openRemoteSession(session, uuid, "gui", "")
print "Starting VM"
startMyMachine()
More information about the vbox-dev
mailing list