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

Serbia, using alternate spelling 'RS' will fail to create a valid CountryInfo object #31

Closed
Lama09 opened this issue Jul 21, 2021 · 6 comments

Comments

@Lama09
Copy link

Lama09 commented Jul 21, 2021

I try to get the info() output from Serbia while I use iso alpha2 "RS" for the country name.

CountryInfo('RS').info()

The code fails with an key error for 'rs' While 'RS' is not in the altSpellings list.

File "..\countryinfo.py", line 133, in capital _capital = self.__countries[self.__country_name]['capital'] KeyError: 'rs'

Running this code for other countries using alpha2 will work.
CountryInfo('DE').info()

I'm not sure if the the constructor of CountryInfo should support the iso alpha2 name as well?

I tried than to switch to full country name and encountered a problem with country name Czechia. Your help is much appriceated.

BR Lama

dilettagoglia added a commit to dilettagoglia/countryinfo that referenced this issue Nov 4, 2021
Update serbia.json
@dilettagoglia
Copy link
Contributor

This issue should be fixed when pull request #35 will be approved

@porimol
Copy link
Owner

porimol commented Nov 5, 2021

@Lama09 resolved this issue.

@dilettagoglia thanks for your PR.

@dilettagoglia
Copy link
Contributor

You're welcome. And thank you for this library, it's so helpful!

@porimol
Copy link
Owner

porimol commented Nov 5, 2021

@Lama09 I'm closing this issue as its resolved!

@porimol porimol closed this as completed Nov 5, 2021
@hsks
Copy link

hsks commented Feb 20, 2023

@porimol this issue isn't resolved it seems. Fetching country info using 'RS' still gives the same error as 'RS' is not present in altSpellings.

@sentinel-1
Copy link
Contributor

The issue is not resolved for the standard PyPi version, i.e., if we do:

pip install countryinfo

It installs version where this issue is not fixed. Alternatively, if we do:

pip install git+https://github.com/porimol/countryinfo.git@master

Only then we install the version where it is fixed (at least currently).

Conclusion: the fixed version is not synchronized with PyPi, it needs to be updated there too.

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

5 participants