Uploaded image for project: 'Picard'
  1. Picard
  2. PICARD-1807

Wrong error handling when using python-libdiscid

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2.4.0b1
    • 2.3.2
    • None
    • None
    • Ubuntu 19.10 daily build PPA

      For some reason when Picard doesn't detect a CD drive it incorrectly displays an error message saying "module 'libdiscid.compat.discid' has no attribute 'disc'", when it should print the line from the first exception because that's actually useful.

      Example debug log:

      ```
      D: 20:38:14,061 /usr/lib/picard/picard/disc.read:63: Reading CD using device: b'/dev/cdrom'
      E: 20:38:14,065 /usr/lib/picard/picard/util/thread.run:64: Traceback (most recent call last):
       File "/usr/lib/picard/picard/disc.py", line 65, in read
         disc = discid.read(device, features=['mcn'])
       File "/usr/lib/python3/dist-packages/libdiscid/compat/discid.py", line 176, in read
         map(lambda feature: _decode(feature, 'ascii'), features))
       File "/usr/lib/python3/dist-packages/libdiscid/compat/discid.py", line 111, in read
         ), 0))
       File "/usr/lib/python3/dist-packages/libdiscid/_init_.py", line 260, in read
         disc.read(device, features)
       File "libdiscid/_discid.pyx", line 92, in libdiscid._discid.DiscId.read
       File "libdiscid/_discid.pyx", line 70, in libdiscid._discid.DiscId._read
      libdiscid.exceptions.DiscError: cannot open device `/dev/cdrom'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
       File "/usr/lib/picard/picard/util/thread.py", line 60, in run
         result = self.func()
       File "/usr/lib/picard/picard/disc.py", line 70, in read
         except discid.disc.DiscError as e:
      AttributeError: module 'libdiscid.compat.discid' has no attribute 'disc'
      ```

            outsidecontext Philipp Wolfer
            Avamander Avamander
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Version Package
                2.4.0b1