diff --git a/src/libprs500/__init__.py b/src/libprs500/__init__.py index b3f4fda6f0..f13f9185cb 100644 --- a/src/libprs500/__init__.py +++ b/src/libprs500/__init__.py @@ -36,6 +36,6 @@ the following rule in C{/etc/udev/rules.d/90-local.rules} :: You may have to adjust the GROUP and the location of the rules file to suit your distribution. """ -__version__ = "0.3.3" +__version__ = "0.3.4" __docformat__ = "epytext" __author__ = "Kovid Goyal " diff --git a/src/libprs500/books.py b/src/libprs500/books.py index 56cc3e5304..38ad280b06 100644 --- a/src/libprs500/books.py +++ b/src/libprs500/books.py @@ -93,12 +93,10 @@ class Book(object): self.prefix = prefix self.root = root - def __repr__(self): + def __str__(self): + """ Return a utf-8 encoded string with title author and path information """ return self.title.encode('utf-8') + " by " + \ self.author.encode('utf-8') + " at " + self.path.encode('utf-8') - - def __str__(self): - return self.__repr__() def fix_ids(media, cache): diff --git a/src/libprs500/communicate.py b/src/libprs500/communicate.py index 6afc9af1bc..8965519fe0 100755 --- a/src/libprs500/communicate.py +++ b/src/libprs500/communicate.py @@ -235,8 +235,7 @@ class PRS500Device(Device): self.handle = self.device.open() self.handle.claim_interface(self.INTERFACE_ID) except USBError, err: - print >> sys.stderr, err - raise DeviceBusy() + raise DeviceBusy(str(err)) # Large timeout as device may still be initializing res = self.send_validated_command(GetUSBProtocolVersion(), timeout=20000) if res.code != 0: diff --git a/src/libprs500/errors.py b/src/libprs500/errors.py index 27b2e24752..a239ccb984 100644 --- a/src/libprs500/errors.py +++ b/src/libprs500/errors.py @@ -38,8 +38,9 @@ class DeviceError(ProtocolError): class DeviceBusy(ProtocolError): """ Raised when device is busy """ - def __init__(self): - ProtocolError.__init__(self, "Device is in use by another application") + def __init__(self, uerr=""): + ProtocolError.__init__(self, "Device is in use by another application:"\ + "\nUnderlying error:" + str(uerr)) class PacketError(ProtocolError): """ Errors with creating/interpreting packets """