porimol / countryinfo

A python module for returning data about countries, ISO info and states/provinces within them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Lama09 opened this issue · comments

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

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

@Lama09 resolved this issue.

@dilettagoglia thanks for your PR.

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

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

@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.

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.