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

data directory is not find! #8

Closed
msalhab96 opened this issue Oct 20, 2022 · 1 comment · Fixed by #11
Closed

data directory is not find! #8

msalhab96 opened this issue Oct 20, 2022 · 1 comment · Fixed by #11

Comments

@msalhab96
Copy link

after installing the package,

and using the below code

from Countrydetails import countries

data = countries.all_countries()
data.countries() 

it throws an error

     21         states_file_path = dir_path + '/data/states.json'
     22         languages_to_capitals_file_path = dir_path + '/data/langtocountries.json'
---> 23         with open(countries_file_path, encoding='utf-8') as file:
     24             countries_file = json.load(file)
     25             self.countries_file = countries_file

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/Countrydetails/data/countries.json'

it can be solved of I rename it to Data

LiamDeaconAntarcticaAM added a commit to LiamDeaconAntarcticaAM/countrydetails that referenced this issue Jul 26, 2023
When on Windows OS. paths are case insensitive, however the `MANIFEST.in` will match `Data` when bundling the package. 

Partially addresses manumanoj0010#9 and manumanoj0010#8 but would need a new version of the package to be released.
LiamDeaconAntarcticaAM added a commit to LiamDeaconAntarcticaAM/countrydetails that referenced this issue Jul 26, 2023
@tanveerahmad74
Copy link

tanveerahmad74 commented Jan 23, 2024

There's still an issue in the country_detail class in country.py file line number 39 [if country_info.get('name', None):]
country_info contains dicts of list.

if country_info.get('name', None):
AttributeError: 'list' object has no attribute 'get'

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