openatv/enigma2

number format crash

hurzl opened this issue · 2 comments

value += (f"{item:0{len(str(self.limits[num][1]))}d}")

20:52:47.3964   File "/usr/lib/enigma2/python/Screens/Screen.py", line 128, in show
20:52:47.3986   File "/usr/lib/enigma2/python/Screens/Setup.py", line 263, in addWatcher
20:52:47.4006   File "/usr/lib/enigma2/python/Screens/Setup.py", line 273, in selectionChanged
20:52:47.4026   File "/usr/lib/enigma2/python/Components/ConfigList.py", line 287, in getCurrentValue
20:52:47.4046   File "/usr/lib/enigma2/python/Components/config.py", line 1100, in getText
20:52:47.4066   File "/usr/lib/enigma2/python/Components/config.py", line 1121, in genText
20:52:47.4086 ValueError: Unknown format code 'd' for object of type 'float'

Can I please have a complete log file so I can see how we got to this crash. Also please describe where you were in the UI and what you were doing.

While the line you posted can be protected from a crash it does not solve any underlying problems. I prefer to fix the cause of the issue and not just one of the symptoms.

It happens when frequencies are to be shown (manual search)

Full log:

20:53:04.5248 Traceback (most recent call last):
20:53:04.5252   File "/usr/lib/enigma2/python/Components/ActionMap.py", line 277, in action
20:53:04.5271   File "/usr/lib/enigma2/python/Screens/MessageBox.py", line 162, in select
20:53:04.5293   File "/usr/lib/enigma2/python/Screens/Screen.py", line 120, in close
20:53:04.5311   File "/usr/lib/enigma2/python/StartEnigma.py", line 197, in close
20:53:04.5356     self.execEnd()
20:53:04.5364   File "/usr/lib/enigma2/python/StartEnigma.py", line 106, in execEnd
20:53:04.5397     self.popSummary()
20:53:04.5405   File "/usr/lib/enigma2/python/StartEnigma.py", line 213, in popSummary
20:53:04.5452     self.summary.show()
20:53:04.5460   File "/usr/lib/enigma2/python/Plugins/SystemPlugins/AnimationSetup/plugin.py", line 247, in screen_show
20:53:04.5479   File "/usr/lib/enigma2/python/Screens/Screen.py", line 128, in show
20:53:04.5498   File "/usr/lib/enigma2/python/Screens/Setup.py", line 263, in addWatcher
20:53:04.5516   File "/usr/lib/enigma2/python/Screens/Setup.py", line 273, in selectionChanged
20:53:04.5535   File "/usr/lib/enigma2/python/Components/ConfigList.py", line 287, in getCurrentValue
20:53:04.5552   File "/usr/lib/enigma2/python/Components/config.py", line 1100, in getText
20:53:04.5570   File "/usr/lib/enigma2/python/Components/config.py", line 1121, in genText
20:53:04.5592 ValueError: Unknown format code 'd' for object of type 'float'

Can't it be easily fixed by (somehow) just using format .0f instead of d?

... Yes, please use .0fand remove the thousands separator.