{"id":23337,"library":"babelfish","title":"babelfish","description":"A Python library for working with countries and languages, providing enums, conversion, and lookup utilities. Current version is 0.6.1 (released 2023-11-26), with a slow release cadence (~yearly). Supports Python >=3.8.","status":"active","version":"0.6.1","language":"python","source_language":"en","source_url":"https://github.com/Diaoul/babelfish","tags":["countries","languages","iso-3166","iso-639","enum"],"install":[{"cmd":"pip install babelfish","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":null,"symbol":"Country","correct":"from babelfish import Country"},{"note":"","wrong":null,"symbol":"Language","correct":"from babelfish import Language"}],"quickstart":{"code":"from babelfish import Country, Language\n\n# Look up by code\nc = Country('US')\nprint(c.name)  # United States\n\nl = Language('eng')\nprint(l.name)  # English\n\n# From alpha3 code (three-letter)\nprint(Country.fromalpha3('USA'))  # Country('US')","lang":"python","description":"Basic usage: create Country and Language objects from codes and access properties."},"warnings":[{"fix":"Create a new object if you need a different code.","message":"Country and Language objects use enums internally but are not directly mutable after creation. Trying to set attributes may raise AttributeError.","severity":"gotcha","affected_versions":"all"},{"fix":"Use importlib.resources as replacement if needed.","message":"pkg_resources usage was removed in 0.6.0. If you rely on package resources via babelfish, you may need to adjust.","severity":"deprecated","affected_versions":">=0.6.0"},{"fix":"Always use uppercase codes (e.g., 'US', 'GB').","message":"Country codes are case-sensitive internally. 'us' is not the same as 'US' for direct instantiation; use upper-case strings.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Reinstall with: pip install --upgrade babelfish. The correct import is: from babelfish import Country","cause":"Partial or old installation, or wrong import path.","error":"ImportError: cannot import name 'Country' from 'babelfish'"},{"fix":"Rename your local file (e.g., babelfish_example.py) and remove any cached .pyc files.","cause":"File named babelfish.py in current directory shadows the library.","error":"AttributeError: module 'babelfish' has no attribute 'Country'"},{"fix":"Use uppercase: Country('US')","cause":"Country constructor expects uppercase ISO 3166-1 alpha-2 codes.","error":"Unknown code: us"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}