Minor cleanups

This commit is contained in:
Kovid Goyal 2007-01-15 17:41:31 +00:00
parent 6a8ed44d3e
commit 19367baec8
4 changed files with 7 additions and 9 deletions

View File

@ -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 <kovid@kovidgoyal.net>"

View File

@ -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):

View File

@ -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:

View File

@ -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 """