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

Python 3.x cmp fix #37

Closed canihavesomecoffee closed 9 years ago

canihavesomecoffee commented 9 years ago

Hello,

using Python 3.x on Windows, I got the next error while trying out some code:

Traceback (most recent call last):
  File "C:/Users/.../virtualboxtest/main.py", line 23, in <module>
    gs = session.console.guest.create_session('...','...')
  File "C:\Python34\lib\site-packages\virtualbox\library_ext\guest.py", line 20, in create_session
    if session.status == library.GuestSessionStatus.started:
  File "C:\Python34\lib\site-packages\virtualbox\library_base.py", line 82, in __eq__
    return self.__cmp__(k) == 0
  File "C:\Python34\lib\site-packages\virtualbox\library_base.py", line 85, in __cmp__
    return cmp(int(self), int(k))
NameError: name 'cmp' is not defined

I took the liberty of fixing this by adding the method if the import of the 2.x builtins fails (indicating python 3.x).

canihavesomecoffee commented 9 years ago

Removed the cmp function entirely :)