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

RecursionError: maximum recursion depth exceeded in comparison #100

Closed blakem17 closed 6 years ago

blakem17 commented 6 years ago
ENVIRONMENT
SUMMARY

RecursionError: maximum recursion depth exceeded When trying virtualbox.library_ext.IMachine.clone()

STEPS TO REPRODUCE
import virtualbox
vb = virtualbox.library_ext.IMachine()
vb.clone("DB01")
EXPECTED RESULTS

Expected to have the machine cloned

ACTUAL RESULTS
Traceback (most recent call last):
  File "C:\Users\name\source\repos\supsup\sup\module1.py", line 4, in <module>
    vb.clone("DB01")
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\virtualbox\library_ext\machine.py", line 94, in clone
    snapshot = self.find_snapshot(snapshot_name_or_id)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\virtualbox\library.py", line 12787, in find_snapshot
    in_p=[name_or_id])
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\virtualbox\library_base.py", line 184, in _call
    method = self._search_attr(name)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\virtualbox\library_base.py", line 161, in _search_attr
    raise AttributeError("Failed to find attribute %s in %s" % (name, self))
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\virtualbox\library_ext\machine.py", line 25, in __str__
    return self.name
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\virtualbox\library.py", line 9619, in name
    ret = self._get_attr("name")
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\virtualbox\library_base.py", line 165, in _get_attr
    attr = self._search_attr(name, prefix='get')
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\virtualbox\library_base.py", line 161, in _search_attr
    raise AttributeError("Failed to find attribute %s in %s" % (name, self))
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\virtualbox\library_ext\machine.py", line 25, in __str__
    return self.name
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\virtualbox\library.py", line 9619, in name
    ret = self._get_attr("name")
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\virtualbox\library_base.py", line 165, in _get_attr
    attr = self._search_attr(name, prefix='get')

(Edited to snip the traceback and make the code sections readable -@SethMichaelLarson)

sethmlarson commented 6 years ago

Thanks for reporting this issue! I'll take a look :) Could you try installing the latest pyvbox and see if it reproduces there as well?

sethmlarson commented 6 years ago

So this recursion error is unfortunate because the error is trying to print out of the name of the machine within the error but the thing is the machine doesn't exist. To get a machine use the following method:

vbox = virtualbox.VirtualBox()
machine = vbox.find_machine('NAME OF MACHINE')
machine.clone('DB01')

Does this work for you?

blakem17 commented 6 years ago

Awesome Thank you very much. Issue is fixed. Please Feel free to resolve this issue

sethmlarson commented 6 years ago

I'm glad I could help you out! :)