{"id":21473,"library":"isocodes","title":"isocodes","description":"isocodes provides lists of various ISO standards (e.g., country, language, language scripts, and currency names) in one place. Current version 2025.8.25, updated regularly with new releases.","status":"active","version":"2025.8.25","language":"python","source_language":"en","source_url":"https://github.com/oubiwann/isocodes","tags":["iso","standards","countries","languages","currencies"],"install":[{"cmd":"pip install isocodes","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for accessing JSON data files in Python 3.9+ (standard library since 3.9, but sometimes needed as backport).","package":"importlib-resources","optional":false}],"imports":[{"note":"The main class is capitalized 'IsoCodes', not lowercase.","wrong":"from isocodes import isocodes","symbol":"IsoCodes","correct":"from isocodes import IsoCodes"}],"quickstart":{"code":"from isocodes import IsoCodes\n\ncodes = IsoCodes()\nfor country in codes.countries:\n    if country.name == 'United States':\n        print('Alpha-2:', country.alpha_2, ', Numeric:', country.numeric)","lang":"python","description":"Create an IsoCodes instance and iterate over countries to access attributes like name, alpha_2, and numeric."},"warnings":[{"fix":"Use dot notation: e.g., country.name, not country.get('name').","message":"Data fields (e.g., 'name', 'alpha_2') are stored as lists of objects, not dictionaries. Access via attribute (e.g., country.name) not via 'get'.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the IsoCodes class instead of accessing data files via pkg_resources or importlib_resources directly.","message":"Direct import of JSON data paths is deprecated. Use IsoCodes class to access data programmatically.","severity":"deprecated","affected_versions":">=2025"},{"fix":"Filter as needed: e.g., [c for c in codes.countries if c.alpha_2 == 'US'].","message":"The 'countries' attribute returns all countries including those that are not ISO 3166-1? Actually it's the full list; ensure you filter by 'alpha_2' if needed.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install via pip: `pip install isocodes` (no hyphen).","cause":"isocodes not installed or misspelled (common: 'iso-codes' vs 'isocodes').","error":"ModuleNotFoundError: No module named 'isocodes'"},{"fix":"Check available attributes with `dir(codes)`; likely the correct attribute is 'countries' (plural).","cause":"The attribute name might vary; some versions have 'countries' as a property, others as a list.","error":"AttributeError: 'IsoCodes' object has no attribute 'countries'"},{"fix":"Reinstall the package to ensure data files are present: `pip install --upgrade --force-reinstall isocodes`.","cause":"Missing data files or incorrect initialization; IsoCodes expects data to be installed alongside the package.","error":"TypeError: 'NoneType' object is not iterable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}