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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot get country-level data #13

Open
daroczig opened this issue Dec 15, 2023 · 2 comments 路 May be fixed by #14
Open

cannot get country-level data #13

daroczig opened this issue Dec 15, 2023 · 2 comments 路 May be fixed by #14

Comments

@daroczig
Copy link

daroczig commented Dec 15, 2023

First of all, thanks for this super cool data and wrapper package 馃檱

All countries data works fine, but I'm facing issues when trying to access a single country, see e.g.

>>> from Countrydetails import country, countries
>>> country.country_details(country_name = 'India')
.../python3.11/site-packages/Countrydetails/data/countries
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../python3.11/site-packages/Countrydetails/country.py", line 39, in __init__
    if country_info.get('name', None):
       ^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'get'

I'm on a case-sensitive file-system, if that might be an issue .. but I have no idea how country_info ended up as a list 馃

@patrysma
Copy link

Same here, when testing using examples from README

@Numbers00
Copy link

At least from my end (tested on Ubuntu 22.04, it's the glob in line 30 in Countrydetails/country.py that's causing the issue.

country_files = [files for files in glob(data_files + '*.json')]

It seems to be getting data/countries.json instead of data/countries/countries.json. You can just prepend a / before *.json there to fix it, but I'm unsure if this works for all platforms.

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