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

Wrong error handling when using python-libdiscid

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 2.3.2
    • Fix Version/s: 2.4.0b1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu 19.10 daily build PPA

      Description

      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'
      ```

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:

                Packages

                Version Package
                2.4.0b1