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

IMachine export / export_to / exportTo #40

Closed z00m1n closed 7 years ago

z00m1n commented 9 years ago

I installed pyvbox 0.2.2 using pip install ... on Mac OS X 10.10 and ran into an error

Traceback (most recent call last):
      ...
    description = target_vm.export_to(appliance, appliance_folder)
  File "/Users/<username>/.virtualenvs/pyvbox/lib/python2.7/site-packages/virtualbox/library_ext/machine.py", line 192, in export_to
    in_p=[appliance, location])
  File "/Users/<username>/.virtualenvs/pyvbox/lib/python2.7/site-packages/virtualbox/library_base.py", line 171, in _call
    method = self._search_attr(name)
  File "/Users/<username>/.virtualenvs/pyvbox/lib/python2.7/site-packages/virtualbox/library_base.py", line 152, in _search_attr
    raise AttributeError("Failed to find attribute %s in %s" % (name, self))
AttributeError: Failed to find attribute export in <VM name>

when trying to export an appliance. The comment next to the export_to(...) function in question

    # BUG: xidl describes this function as exportTo.  The interface seems
    #      to export plain "export" instead... 

seems to indicate there is/was a mix-up with function names.

I had to change the code in line 191 from self._call("export", ... to self._call("exportTo", ... to fix the error. My speculation is that the mentioned bug existed previously (i.e. for earlier versions of VirtualBox), but has now been fixed; I'm not entirely sure which parts this concerns, though.

I have installed the latest VirtualBox 5.0.8 r103449 and I presume pyvbox picks up stuff from that.

If you could kindly tell me how to get the version of the underlying VirtualBox Python modules, I'd be happy to try and provide a pull request with version-specific handling.

mjdorma commented 9 years ago

Nice, thanks for the report. You're 100% correct!

Feel free to send a PR, otherwise I'll fix this when I get some spare cycles.

Cheers

sethmlarson commented 7 years ago

This seems to have been fixed.