Public bug reported:

While selecting the best mirror in software-properties-qt, there's a
traceback:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/softwareproperties/qt/DialogMirror.py", 
line 227, in on_report_progress
    self.dialog.setValue(frac*100)
TypeError: setValue(self, progress: int): argument 1 has unexpected type 'float'

I didn't investigate thoroughly, but it looks like maybe someone updated
how progress was being updated but didn't check types or test all the
way through before releasing.  It can be fixed with a simple patch:

diff --git a/softwareproperties/qt/DialogMirror.py 
b/softwareproperties/qt/DialogMirror.py
index 972c4fb..4d1c150 100644
--- a/softwareproperties/qt/DialogMirror.py
+++ b/softwareproperties/qt/DialogMirror.py
@@ -223,7 +223,7 @@ class DialogMirror(QDialog):
   def on_report_progress(self, current, max, borders=(0,1), mod=(0,0)):
       #self.dialog.setLabelText(_("Completed %s of %s tests") % \
       #                       (current + mod[0], max + mod[1]))
-      frac = borders[0] + (borders[1] - borders[0]) / max * current
+      frac = int(borders[0] + (borders[1] - borders[0]) / max * current)
       self.dialog.setValue(frac*100)


$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 23.10
Release:        23.10
Codename:       mantic

$ apt-cache policy pkgname software-properties-qt
software-properties-qt:
  Installed: 0.99.39
  Candidate: 0.99.39
  Version table:
 *** 0.99.39 500
        500 https://mirror.it.ubc.ca/ubuntu mantic/universe amd64 Packages
        100 /var/lib/dpkg/status
N: Unable to locate package pkgname

** Affects: software-properties (Ubuntu)
     Importance: Undecided
         Status: New

** Patch added: "patch to cast float to int for progress dialog"
   
https://bugs.launchpad.net/bugs/2046639/+attachment/5729851/+files/qt_DialogMirror_unexpected_float.patch

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

Title:
  qt DialogMirror.py argument 1 has unexpected type 'float' while
  selecting best mirror

Status in software-properties package in Ubuntu:
  New

Bug description:
  While selecting the best mirror in software-properties-qt, there's a
  traceback:

  Traceback (most recent call last):
    File 
"/usr/lib/python3/dist-packages/softwareproperties/qt/DialogMirror.py", line 
227, in on_report_progress
      self.dialog.setValue(frac*100)
  TypeError: setValue(self, progress: int): argument 1 has unexpected type 
'float'

  I didn't investigate thoroughly, but it looks like maybe someone
  updated how progress was being updated but didn't check types or test
  all the way through before releasing.  It can be fixed with a simple
  patch:

  diff --git a/softwareproperties/qt/DialogMirror.py 
b/softwareproperties/qt/DialogMirror.py
  index 972c4fb..4d1c150 100644
  --- a/softwareproperties/qt/DialogMirror.py
  +++ b/softwareproperties/qt/DialogMirror.py
  @@ -223,7 +223,7 @@ class DialogMirror(QDialog):
     def on_report_progress(self, current, max, borders=(0,1), mod=(0,0)):
         #self.dialog.setLabelText(_("Completed %s of %s tests") % \
         #                       (current + mod[0], max + mod[1]))
  -      frac = borders[0] + (borders[1] - borders[0]) / max * current
  +      frac = int(borders[0] + (borders[1] - borders[0]) / max * current)
         self.dialog.setValue(frac*100)

  
  $ lsb_release -a
  No LSB modules are available.
  Distributor ID:       Ubuntu
  Description:  Ubuntu 23.10
  Release:      23.10
  Codename:     mantic

  $ apt-cache policy pkgname software-properties-qt
  software-properties-qt:
    Installed: 0.99.39
    Candidate: 0.99.39
    Version table:
   *** 0.99.39 500
          500 https://mirror.it.ubc.ca/ubuntu mantic/universe amd64 Packages
          100 /var/lib/dpkg/status
  N: Unable to locate package pkgname

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