Skip to content

Commit

Permalink
Fix module 'locale' has no attribute 'format'
Browse files Browse the repository at this point in the history
Fixes the following error on python 3.12:
 Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/qtvcp/widgets/origin_offsetview.py",
   line 383, in periodic_check
    self.reload_offsets()
  File "/usr/lib/python3.12/site-packages/qtvcp/widgets/origin_offsetview.py",
   line 270, in reload_offsets
    degree_tmpl = "%{}.2f".format(len(locale.format(tmpl, 0)))
                                      ^^^^^^^^^^^^^
 AttributeError: module 'locale' has no attribute 'format'. Did you mean: '_format'?

See also: python/cpython#94226

Signed-off-by: Damian Wrobel <[email protected]>
  • Loading branch information
dwrobel committed Dec 11, 2023
1 parent cac8b1b commit 8d9dec5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/python/qtvcp/widgets/origin_offsetview.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,18 @@ def reload_offsets(self):
else:
tmpl = self.imperial_text_template

degree_tmpl = "%{}.2f".format(len(locale.format(tmpl, 0)))
degree_tmpl = "%{}.2f".format(len(locale.format_string(tmpl, 0)))

# fill each row of the liststore from the offsets arrays
for row, i in enumerate([ap, rot, g92, tool, g54, g55, g56, g57, g58, g59, g59_1, g59_2, g59_3]):
for column in range(0, 9):
if row == 1:
if column == 2:
self.tabledata[row][column] = locale.format(degree_tmpl, rot)
self.tabledata[row][column] = locale.format_string(degree_tmpl, rot)
else:
self.tabledata[row][column] = " "
else:
self.tabledata[row][column] = locale.format(tmpl, i[column])
self.tabledata[row][column] = locale.format_string(tmpl, i[column])
self.tablemodel.layoutChanged.emit()

# We read the var file directly
Expand Down

0 comments on commit 8d9dec5

Please sign in to comment.