Control: forwarded -1 https://bugs.launchpad.net/hplip/+bug/2045507
Control: tags -1 + patch

On Thu, Jan 15, 2026 at 11:54:22AM +0100, Agustin Martin wrote:
> On Wed, Jan 14, 2026 at 11:03:50PM +0200, Henrik Ahlgren wrote:
> > Package: hplip
> > Version: 3.22.10+dfsg0-8.1
> > Severity: normal
> > I've noticed also one more Python 3.13 compatibility problem, in
> > base/utils.py:
> > 
> > 
> > hp-config_usb_printer[214163]: debug: Traceback (most recent call last):
> >   File "/usr/bin/hp-firmware", line 189, in <module>
> >     if d.downloadFirmware(usb_bus_id, usb_device_id):
> >        ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >   File "/usr/share/hplip/base/device.py", line 2642, in downloadFirmware
> >     log.debug("%s bytes downloaded." % utils.commafy(bytes_written))
> >                                        ~~~~~~~~~~~~~^^^^^^^^^^^^^^^
> >   File "/usr/share/hplip/base/utils.py", line 476, in commafy
> >     return locale.format("%s", val, grouping=True)
> >            ^^^^^^^^^^^^^
> > AttributeError: module 'locale' has no attribute 'format'
> > 
> > 
> > This error occurs because the format function has been removed from the
> > locale module in Python 3.12. To fix it, you should replace calls to
> > locale.format with the appropriate alternative, such as using
> > locale.format_string instead.
> 
> I think this one is not yet handled in Debian. Do not know if is fixed
> in last upstream version.

Hi,

Noticed that this problem has been reported upstream and patch proposed.
I am tagging bug as forwarded and attaching that patch both in raw and
'git format-patch' formats.

I do not have an HP printer here, so cannot check myself.

Hope it helps.

-- 
Agustin
diff --git a/base/utils.py b/base/utils.py
index e2de550..55848b8 100644
--- a/base/utils.py
+++ b/base/utils.py
@@ -474,7 +474,7 @@ def sort_dict_by_value(d):
 
 
 def commafy(val):
-    return locale.format("%s", val, grouping=True)
+    return locale.format_string("%s", val, grouping=True)
 
 
 def format_bytes(s, show_bytes=False):
>From 22e947730231248d45dfdfdbf56c269c67ddde90 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <[email protected]>
Date: Mon, 19 Jan 2026 18:43:36 +0100
Subject: [PATCH] base/utils.py: Fix "utils.py attempts to access unknown
 locale.format attribute".

Upstream-Bug: https://bugs.launchpad.net/hplip/+bug/2045507
Debian-Bug: #1125496
---
 base/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/base/utils.py b/base/utils.py
index 9986dd1e..b283ca75 100644
--- a/base/utils.py
+++ b/base/utils.py
@@ -474,7 +474,7 @@ def sort_dict_by_value(d):
 
 
 def commafy(val):
-    return locale.format("%s", val, grouping=True)
+    return locale.format_string("%s", val, grouping=True)
 
 
 def format_bytes(s, show_bytes=False):
-- 
2.51.0

Reply via email to