Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'cannot change locale'; 'printf: null: invalid number' #20

Open
LinuxOnTheDesktop opened this issue Apr 24, 2020 · 6 comments
Open

'cannot change locale'; 'printf: null: invalid number' #20

LinuxOnTheDesktop opened this issue Apr 24, 2020 · 6 comments
Assignees

Comments

@LinuxOnTheDesktop
Copy link

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.

@lesnake
Copy link

lesnake commented May 1, 2020

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

@LinuxOnTheDesktop
Copy link
Author

LinuxOnTheDesktop commented May 1, 2020

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.

@lesnake
Copy link

lesnake commented May 1, 2020

You need to edit /etc/locale.gen AND run locale-gen as root.

@LinuxOnTheDesktop
Copy link
Author

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.

@Sagez
Copy link

Sagez commented May 6, 2020

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"

@LinuxOnTheDesktop
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants