** Description changed:

- Hello, we received a drive-by complaint about the ubuntu-drivers
- autoinstall tool:
+ == Changelogs ==
+ 
+ === Kinetic and Jammy ===
+ 
+   [ Alberto Milone ]
+   * debian/rules:
+     - Limit the tests to the selected architectures (amd64, arm64).
+       This prevents armhf builds from failing.
+   * UbuntuDrivers/detect.py:
+     - Make sure all -open drivers have a lower priority, regardless
+       of whether the --server parameter is passed in or not.
+     - Update regex and unify package name parsing in the following
+       functions by using the new NvidiaPkgNameInfo class:
+       nvidia_desktop_pre_installation_hook,
+       _get_headless_no_dkms_metapackage, 
+       nvidia_desktop_pre_installation_hook,
+       get_linux_modules_metapackage,
+       This prevents ubuntu-drivers from crashing when dealing with
+       the -open NVIDIA drivers (LP: #1993019).
+   * tests/test_ubuntu_drivers.py:
+     - Add tests so we make sure to keep preferring non-open NVIDIA
+       modules over the -open ones, at least until the open modules catch up
+       feature wise and performance wise.
+ 
+   [ gongzhengyang ]
+   * UbuntuDrivers/detect.py:
+     - Fix local variable 'version' being referenced before assignment
+       when catching ValueError (LP: #1993019).
+ 
+   [ Jeff Lane ]
+   * detect-plugins/sl-modem.py:
+     - Add some error trapping when aplay is not installed (on servers).
+ 
+ ____
+ Hello, we received a drive-by complaint about the ubuntu-drivers autoinstall 
tool:
  
  < Fhazal> hye i have problem with ubuntu 22.04 nvidia auto install command
  < Fhazal> this error appear when i try to auto install recommended driver
  < Fhazal> https://pastebin.com/ydZVFT24
  
  The contents of the pastebin:
  
  Traceback (most recent call last):
-   File "/usr/bin/ubuntu-drivers", line 513, in <module>
-     greet()
-   File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
-     return self.main(*args, **kwargs)
-   File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
-     rv = self.invoke(ctx)
-   File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
-     return _process_result(sub_ctx.command.invoke(sub_ctx))
-   File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
-     return ctx.invoke(self.callback, **ctx.params)
-   File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
-     return __callback(*args, **kwargs)
-   File "/usr/lib/python3/dist-packages/click/decorators.py", line 84, in 
new_func
-     return ctx.invoke(f, obj, *args, **kwargs)
-   File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
-     return __callback(*args, **kwargs)
-   File "/usr/bin/ubuntu-drivers", line 432, in autoinstall
-     command_install(config)
-   File "/usr/bin/ubuntu-drivers", line 187, in command_install
-     UbuntuDrivers.detect.nvidia_desktop_pre_installation_hook(to_install)
-   File "/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py", line 839, in 
nvidia_desktop_pre_installation_hook
-     with_nvidia_kms = version >= 470
+   File "/usr/bin/ubuntu-drivers", line 513, in <module>
+     greet()
+   File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
+     return self.main(*args, **kwargs)
+   File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
+     rv = self.invoke(ctx)
+   File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
+     return _process_result(sub_ctx.command.invoke(sub_ctx))
+   File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
+     return ctx.invoke(self.callback, **ctx.params)
+   File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
+     return __callback(*args, **kwargs)
+   File "/usr/lib/python3/dist-packages/click/decorators.py", line 84, in 
new_func
+     return ctx.invoke(f, obj, *args, **kwargs)
+   File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
+     return __callback(*args, **kwargs)
+   File "/usr/bin/ubuntu-drivers", line 432, in autoinstall
+     command_install(config)
+   File "/usr/bin/ubuntu-drivers", line 187, in command_install
+     UbuntuDrivers.detect.nvidia_desktop_pre_installation_hook(to_install)
+   File "/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py", line 839, in 
nvidia_desktop_pre_installation_hook
+     with_nvidia_kms = version >= 470
  UnboundLocalError: local variable 'version' referenced before assignment
- 
  
  Skimming the version on my system it sure feels plausible:
  
  def nvidia_desktop_pre_installation_hook(to_install):
-     '''Applies changes that need to happen before installing the NVIDIA 
drivers'''
-     with_nvidia_kms = False
+     '''Applies changes that need to happen before installing the NVIDIA 
drivers'''
+     with_nvidia_kms = False
  
-     # Enable KMS if nvidia >= 470
-     for package_name in to_install:
-         if package_name.startswith('nvidia-driver-'):
-             try:
-                 version = int(package_name.split('-')[-1])
-             except ValueError:
-                 pass
-             finally:
-                 with_nvidia_kms = version >= 470
+     # Enable KMS if nvidia >= 470
+     for package_name in to_install:
+         if package_name.startswith('nvidia-driver-'):
+             try:
+                 version = int(package_name.split('-')[-1])
+             except ValueError:
+                 pass
+             finally:
+                 with_nvidia_kms = version >= 470
  
-     if with_nvidia_kms:
-         set_nvidia_kms(1)
- 
+     if with_nvidia_kms:
+         set_nvidia_kms(1)
  
  If there was an exception splitting, indexing, or converting to an int,
  that 'version' variable may not have a value.
  
  Thanks

** Description changed:

  == Changelogs ==
  
  === Kinetic and Jammy ===
  
-   [ Alberto Milone ]
-   * debian/rules:
-     - Limit the tests to the selected architectures (amd64, arm64).
-       This prevents armhf builds from failing.
-   * UbuntuDrivers/detect.py:
-     - Make sure all -open drivers have a lower priority, regardless
-       of whether the --server parameter is passed in or not.
-     - Update regex and unify package name parsing in the following
-       functions by using the new NvidiaPkgNameInfo class:
-       nvidia_desktop_pre_installation_hook,
-       _get_headless_no_dkms_metapackage, 
-       nvidia_desktop_pre_installation_hook,
-       get_linux_modules_metapackage,
-       This prevents ubuntu-drivers from crashing when dealing with
-       the -open NVIDIA drivers (LP: #1993019).
-   * tests/test_ubuntu_drivers.py:
-     - Add tests so we make sure to keep preferring non-open NVIDIA
-       modules over the -open ones, at least until the open modules catch up
-       feature wise and performance wise.
+   [ Alberto Milone ]
+   * debian/rules:
+     - Limit the tests to the selected architectures (amd64, arm64).
+       This prevents armhf builds from failing.
+   * UbuntuDrivers/detect.py:
+     - Make sure all -open drivers have a lower priority, regardless
+       of whether the --server parameter is passed in or not.
+     - Update regex and unify package name parsing in the following
+       functions by using the new NvidiaPkgNameInfo class:
+       nvidia_desktop_pre_installation_hook,
+       _get_headless_no_dkms_metapackage,
+       nvidia_desktop_pre_installation_hook,
+       get_linux_modules_metapackage,
+       This prevents ubuntu-drivers from crashing when dealing with
+       the -open NVIDIA drivers (LP: #1993019).
+   * tests/test_ubuntu_drivers.py:
+     - Add tests so we make sure to keep preferring non-open NVIDIA
+       modules over the -open ones, at least until the open modules catch up
+       feature wise and performance wise.
  
-   [ gongzhengyang ]
-   * UbuntuDrivers/detect.py:
-     - Fix local variable 'version' being referenced before assignment
-       when catching ValueError (LP: #1993019).
+   [ gongzhengyang ]
+   * UbuntuDrivers/detect.py:
+     - Fix local variable 'version' being referenced before assignment
+       when catching ValueError (LP: #1993019).
  
-   [ Jeff Lane ]
-   * detect-plugins/sl-modem.py:
-     - Add some error trapping when aplay is not installed (on servers).
+   [ Jeff Lane ]
+   * detect-plugins/sl-modem.py:
+     - Add some error trapping when aplay is not installed (on servers).
+ 
+ === Jammy only (left over from 1:0.9.6.2~0.22.04.1) ===
+ 
+    * UbuntuDrivers/detect.py:
+      - Make sure -open drivers have a lower priority (LP: #1988836).
  
  ____
  Hello, we received a drive-by complaint about the ubuntu-drivers autoinstall 
tool:
  
  < Fhazal> hye i have problem with ubuntu 22.04 nvidia auto install command
  < Fhazal> this error appear when i try to auto install recommended driver
  < Fhazal> https://pastebin.com/ydZVFT24
  
  The contents of the pastebin:
  
  Traceback (most recent call last):
    File "/usr/bin/ubuntu-drivers", line 513, in <module>
      greet()
    File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
      return self.main(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
      rv = self.invoke(ctx)
    File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
      return ctx.invoke(self.callback, **ctx.params)
    File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
      return __callback(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/click/decorators.py", line 84, in 
new_func
      return ctx.invoke(f, obj, *args, **kwargs)
    File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
      return __callback(*args, **kwargs)
    File "/usr/bin/ubuntu-drivers", line 432, in autoinstall
      command_install(config)
    File "/usr/bin/ubuntu-drivers", line 187, in command_install
      UbuntuDrivers.detect.nvidia_desktop_pre_installation_hook(to_install)
    File "/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py", line 839, in 
nvidia_desktop_pre_installation_hook
      with_nvidia_kms = version >= 470
  UnboundLocalError: local variable 'version' referenced before assignment
  
  Skimming the version on my system it sure feels plausible:
  
  def nvidia_desktop_pre_installation_hook(to_install):
      '''Applies changes that need to happen before installing the NVIDIA 
drivers'''
      with_nvidia_kms = False
  
      # Enable KMS if nvidia >= 470
      for package_name in to_install:
          if package_name.startswith('nvidia-driver-'):
              try:
                  version = int(package_name.split('-')[-1])
              except ValueError:
                  pass
              finally:
                  with_nvidia_kms = version >= 470
  
      if with_nvidia_kms:
          set_nvidia_kms(1)
  
  If there was an exception splitting, indexing, or converting to an int,
  that 'version' variable may not have a value.
  
  Thanks

-- 
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/1993019

Title:
  UnboundLocalError: local variable 'version' referenced before
  assignment

Status in ubuntu-drivers-common package in Ubuntu:
  Fix Released
Status in ubuntu-drivers-common source package in Bionic:
  In Progress
Status in ubuntu-drivers-common source package in Focal:
  In Progress
Status in ubuntu-drivers-common source package in Jammy:
  In Progress
Status in ubuntu-drivers-common source package in Kinetic:
  In Progress

Bug description:
  == Changelogs ==

  === Kinetic and Jammy ===

    [ Alberto Milone ]
    * debian/rules:
      - Limit the tests to the selected architectures (amd64, arm64).
        This prevents armhf builds from failing.
    * UbuntuDrivers/detect.py:
      - Make sure all -open drivers have a lower priority, regardless
        of whether the --server parameter is passed in or not.
      - Update regex and unify package name parsing in the following
        functions by using the new NvidiaPkgNameInfo class:
        nvidia_desktop_pre_installation_hook,
        _get_headless_no_dkms_metapackage,
        nvidia_desktop_pre_installation_hook,
        get_linux_modules_metapackage,
        This prevents ubuntu-drivers from crashing when dealing with
        the -open NVIDIA drivers (LP: #1993019).
    * tests/test_ubuntu_drivers.py:
      - Add tests so we make sure to keep preferring non-open NVIDIA
        modules over the -open ones, at least until the open modules catch up
        feature wise and performance wise.

    [ gongzhengyang ]
    * UbuntuDrivers/detect.py:
      - Fix local variable 'version' being referenced before assignment
        when catching ValueError (LP: #1993019).

    [ Jeff Lane ]
    * detect-plugins/sl-modem.py:
      - Add some error trapping when aplay is not installed (on servers).

  === Jammy only (left over from 1:0.9.6.2~0.22.04.1) ===

     * UbuntuDrivers/detect.py:
       - Make sure -open drivers have a lower priority (LP: #1988836).

  ____
  Hello, we received a drive-by complaint about the ubuntu-drivers autoinstall 
tool:

  < Fhazal> hye i have problem with ubuntu 22.04 nvidia auto install command
  < Fhazal> this error appear when i try to auto install recommended driver
  < Fhazal> https://pastebin.com/ydZVFT24

  The contents of the pastebin:

  Traceback (most recent call last):
    File "/usr/bin/ubuntu-drivers", line 513, in <module>
      greet()
    File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
      return self.main(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
      rv = self.invoke(ctx)
    File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
      return ctx.invoke(self.callback, **ctx.params)
    File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
      return __callback(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/click/decorators.py", line 84, in 
new_func
      return ctx.invoke(f, obj, *args, **kwargs)
    File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
      return __callback(*args, **kwargs)
    File "/usr/bin/ubuntu-drivers", line 432, in autoinstall
      command_install(config)
    File "/usr/bin/ubuntu-drivers", line 187, in command_install
      UbuntuDrivers.detect.nvidia_desktop_pre_installation_hook(to_install)
    File "/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py", line 839, in 
nvidia_desktop_pre_installation_hook
      with_nvidia_kms = version >= 470
  UnboundLocalError: local variable 'version' referenced before assignment

  Skimming the version on my system it sure feels plausible:

  def nvidia_desktop_pre_installation_hook(to_install):
      '''Applies changes that need to happen before installing the NVIDIA 
drivers'''
      with_nvidia_kms = False

      # Enable KMS if nvidia >= 470
      for package_name in to_install:
          if package_name.startswith('nvidia-driver-'):
              try:
                  version = int(package_name.split('-')[-1])
              except ValueError:
                  pass
              finally:
                  with_nvidia_kms = version >= 470

      if with_nvidia_kms:
          set_nvidia_kms(1)

  If there was an exception splitting, indexing, or converting to an
  int, that 'version' variable may not have a value.

  Thanks

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-drivers-common/+bug/1993019/+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