covid19-cli
covid19-cli copied to clipboard
'cannot change locale'; 'printf: null: invalid number'
Describe the bug
covid19-cli.sh: line 9: warning: setlocale: LC_NUMERIC: cannot change locale (en_US): No such file or directory
✔ Country: united states
jq: error (at <stdin>:1): Cannot iterate over null (null)
jq: error (at <stdin>:1): Cannot iterate over null (null)
[my path]/covid19-cli.sh: line 411: printf: null: invalid number
Cases: 0
[my path]/covid19-cli/dist/covid19-cli.sh: line 412: printf: null: invalid number
Deaths: 0
[my path]/covid19-cli/dist/covid19-cli.sh: line 413: printf: null: invalid number
Recovered: 0
To Reproduce Run the program with seeminly any option.
Expected behavior A clear and concise description of what you expected to happen.
Desktop:
- OS: [e.g. iOS] Linux Mint 19.3 x64 Cinnamon
Software versions GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu) Latest git version of covid19-cli
Additional context I think it is a problem with the data source - for, a similar program that I have has a similar problem - but your program should handle the problem more gracefully.
This is related to a missing locale. Here is what on my ubuntu 19.10 fr_FR:
Open /etc/locale.gen and look for en_US locales. You have to un-comment the "en_US" (1st row in the following snippet), not only the "en_US.something" (watch the dot).
In the end you should have something like this:
en_US ISO-8859-1
# en_US.ISO-8859-15 ISO-8859-15
en_US.UTF-8 UTF-8
Save, then run
locale-gen
Ok, so I located /etc/local.gen
(which is a file) and uncommented # en_US ISO-8859-1
. Then I ran locale-gen
. It seemed to fail. So I re-ran it as root. Then I opened a new terminal and did covid usa
and iI got the same error as before - even after rebooting the computer. EDITED.
You need to edit /etc/locale.gen AND run locale-gen as root.
Thanks. I ran locale-gen
as root. It showed no errors. I logged off and back in again. Your program showed the same problems as before.
i did trace it back to where your url (links) along with BASE_API said {"message":"This endpoint has been deprecated. Use /v2/all instead.","docs":"http://corona.lmao.ninja/docs"} with API_TOTAL_ENDPOINT so i kind tweak a little add /v2/ in end of BASE_API.. in LINE 15 and remove /v2 from API_HISTORICAL_COUNTRIES_ENDPOINT.
BASE_API="https://corona.lmao.ninja/v2" API_TOTAL_ENDPOINT="$BASE_API/all" API_ALL_COUNTRIES_ENDPOINT="$BASE_API/countries" API_HISTORICAL_COUNTRIES_ENDPOINT="$BASE_API/historical"
Thanks. However, I have trouble understanding you. Are you suggesting that . . actually, at this point, I am just going to give up, I am afraid.