[vbox-dev] Restore snapshot through pyhon "AttributeError: Failed to find attribute restoreSnapshot in win 8.1"
klaus.espenlaub at oracle.com
Wed Oct 18 19:35:39 UTC 2017
On 18.10.2017 11:41, kaloon jone wrote:
> Hello There,
> I have VM called Win 11 and I create snapshot called "Snapshot1". Then
> I create python file to restore the VM through python script. I got
> error I can'y understand what is it. I search on internet since three
> day I don't found solution . I tried many example But I got the same
> error. The error is
> AttributeError: Failed to find attribute restoreSnapshot in win 8.1
> My python script is : \
> import virtualbox
> import time
> from virtualbox.library import LockType
> vbox = virtualbox.VirtualBox()
> session = virtualbox.Session()
> vm = vbox.find_machine('win 8.1')
> vm.lock_machine(session, LockType.shared)
> console = session.console;
> machine = session.machine
> snapShot = vm.find_snapshot("snapshot 1");
> snapShotProgress = machine.restore_snapshot(snapShot);
This is impossible... can't be your full script. You have stuff like
find_machine, lock_machine, find_snapshot and what not all over the
place, and that's not how our API methods are called. Do you have some
wrapper code which you censored out of the script? Need to know what
you're really doing.
You could also try doing this with vboxshell.py, which is a big piece of
code (not necessarily pretty, but it can serve as inspiration for how to
use a significant portion of the API).
> Can Any help me and explain to me which is the problem. I snapshot is
> created and the Vm is run correctly. but I cannot restore the snapshot
> through python.
We really need to be certain what your script is doing, because so far
it's not making any sense. This should fail straight at "vm =
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vbox-dev