Closed AlexP11223 closed 5 years ago
That error is spitting out initially when starting the conky due to hickups (because temperature is empty when trying to parse) from openweather - connection. The error should disappear after a couple of seconds?
No, it doesn't disappear.
It works if I replace .
to ,
using strings.gsub
before formatting. It's a bad solution obviously, the proper way to fix this is to parse the number ignoring the locale (always use .
), but I don't know how to implement this in conky Lua.
Alright. It sounds like a work-around for the moment;
temperature = tostring((string.format("%.0f", string.gsub(temperature,",","."))))
It replaces comma to dot before formatting?
It would not work (and the weather script already outputs with dot) because the issue is the opposite: format
uses decimal separator from my system locale, which is not dot.
It does work, just tested. See commit: https://github.com/xexpanderx/Conky-themes/commit/34dc9c86019c6df0053c7113fa4350afad971059
Ah sorry, too fast. I am working on something else in parallel. Yes, format uses indeed the system locale...
Try and insert this code and remove (string.gsub):
assert(os.setlocale("en_US.utf8", "numeric"))
This assumes you have "en_US.utf8" installed on your system. A problem arises if "en_US.utf8" is not installed on the system, which will give arise to an assert error.
yeah, looks like it works. :)
I get error
here
This works for me
I tried to remove this formatting line (output the original string) and it worked, except that it outputs
16.22
instead of16
.Looks like some kind of decimal number parsing issue? Most likely because my locale uses
,
instead of.
.My locale:
PopOS 19.04