sethmlarson / virtualbox-python

Complete implementation of VirtualBox's COM API with a Pythonic interface.
https://pypi.org/project/virtualbox
Apache License 2.0
354 stars 75 forks source link

Unable to import appliance! #33

Closed hosseinkhani closed 9 years ago

hosseinkhani commented 9 years ago

Im new to pyvbox I tried to import an ovf file but get this error virtualbox.library.OleErrorFail: 0x80004005 (Cannot interpret appliance without reading it first (call read() before interpret()))

this is the code

import virtualbox vbox = virtualbox.VirtualBox() apl = vbox.create_appliance() apl.read('~/Documents/ubuntu.ova')

why before reading completion , interpret is called!

markhuber commented 9 years ago

I've found that the underlying virtualbox api that pyvbox relies on is extremely temperamental about the path to the file. I suggest running the path through os.path.absdir() and strip() . Even stray characters after os.path.absdir will cause this error.

mjdorma commented 9 years ago

@markhuber I agree. The tilde may be the cause of the issue in the posted example. Cheers

XayOn commented 8 years ago

This is reaaally old, but just to clarify in case anyone comes to this bugreport:

.read('~/Documents/ubuntu.ova') will not find the file (as it really does not exist), therefore the error. What you really whated to do is api.read(os.path.expanduser('~/Documents/ubuntu.ova').