Here is the output without the fix:
Traceback (most recent call last):
  File "/usr/bin/nvidia-detector", line 8, in <module>
    a = NvidiaDetection(printonly=True, verbose=False)
  File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", line 
73, in __init__
    self.getData()
  File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", line 
163, in getData
    driver_version = self.__get_value_from_name(stripped_package_name)
  File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", line 
92, in __get_value_from_name
    v = int(name)
ValueError: invalid literal for int() with base 10: 'server'

Here are is my solution:

In function
    # line 88
    def __get_value_from_name(self, name):
        '''Get the integer associated to the name of a driver'''
        v = self.__driver_aliases.get(name)
        if v is None:
            if name.isdigit(): # I made sure is an int.
                v = int(name)
        return v

    # in line 164 I replaced with :
            if not (driver_version := 
self.__get_value_from_name(stripped_package_name)):
                continue

** Attachment added: "nvidiadetector.py"
   
https://bugs.launchpad.net/ubuntu/+source/ubuntu-drivers-common/+bug/1891183/+attachment/5403712/+files/nvidiadetector.py

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to ubuntu-drivers-common in Ubuntu.
https://bugs.launchpad.net/bugs/1891183

Title:
  the new -server drivers break nvidia-detector

Status in ubuntu-drivers-common package in Ubuntu:
  In Progress
Status in ubuntu-drivers-common source package in Bionic:
  In Progress
Status in ubuntu-drivers-common source package in Focal:
  In Progress

Bug description:
  Calling nvidia-detector, fails when the new -server series are
  available in the archive:

  nvidia-detector
  Traceback (most recent call last):
    File "/usr/bin/nvidia-detector", line 8, in <module>
      a = NvidiaDetection(printonly=True, verbose=False)
    File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", 
line 73, in __init__
      self.getData()
    File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", 
line 163, in getData
      driver_version = self.__get_value_from_name(stripped_package_name)
    File "/usr/lib/python3/dist-packages/NvidiaDetector/nvidiadetector.py", 
line 92, in __get_value_from_name
      v = int(name)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-drivers-common/+bug/1891183/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to