{"id":5970,"library":"iso4217","title":"ISO 4217 Currency Data","description":"The `iso4217` library provides ISO 4217 currency data for Python, represented as an `enum` module. It offers access to current and historical currency codes, names, and numerical values. The library is actively maintained with version `1.16.20260101` and releases new versions regularly to reflect updates to the ISO 4217 standard, typically indicated by a date-based versioning scheme.","status":"active","version":"1.16.20260101","language":"python","source_language":"en","source_url":"https://github.com/dahlia/iso4217","tags":["currency","ISO 4217","finance","enum"],"install":[{"cmd":"pip install iso4217","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The `iso4217` package by dahlia exposes currencies as an `Enum`. Functions like `find_currency` or `iter_currency` belong to other, similarly named libraries (e.g., `python-iso4217`) with different APIs.","wrong":"from iso4217 import find_currency","symbol":"Currency","correct":"from iso4217 import Currency"}],"quickstart":{"code":"from iso4217 import Currency\n\n# Access a currency by its alpha-3 code\nusd = Currency.USD\nprint(f\"USD: {usd.currency_name} ({usd.numeric_code})\")\n\n# Access a currency by its numeric code (if enum supports it, or by value)\ntry:\n    eur = Currency(978) # Access by numeric value\n    print(f\"EUR: {eur.currency_name} ({eur.alpha_code})\")\nexcept ValueError:\n    # If direct numeric access isn't supported, iterate or use a helper (not in this library)\n    eur = next((c for c in Currency if c.numeric_code == 978), None)\n    if eur:\n        print(f\"EUR (found by numeric code): {eur.currency_name} ({eur.alpha_code})\")\n\n# Iterate through all active currencies\nprint(\"\\nAll active currencies:\")\nfor currency in Currency:\n    print(f\"- {currency.alpha_code}: {currency.currency_name}\")\n","lang":"python","description":"The quickstart demonstrates how to import the `Currency` Enum, access specific currencies by their alpha-3 code (e.g., `Currency.USD`), and iterate through all available currencies. Each currency object provides attributes like `currency_name`, `alpha_code`, and `numeric_code`."},"warnings":[{"fix":"Always verify the import paths and API calls against the specific package's documentation or by inspecting the package content. For `dahlia/iso4217`, currencies are typically accessed as members of an `Enum`.","message":"There are several Python packages with similar names (e.g., `python-iso4217`, `iso_4217`, `iso4217parse`) that provide ISO 4217 data but have distinct APIs and features. Ensure you are using the `iso4217` package by `dahlia` to avoid unexpected behavior or import errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Regularly update the package to its latest version (`pip install --upgrade iso4217`) to ensure you have the most current ISO 4217 data. The package's versioning (e.g., `1.16.YYYYMMDD`) often indicates the date of the data snapshot.","message":"ISO 4217 currency data is subject to periodic amendments (e.g., currency adoptions, withdrawals). Relying on an outdated version of the `iso4217` package can lead to incorrect or incomplete currency information.","severity":"gotcha","affected_versions":"< 1.16.20260101"}],"env_vars":null,"search_vec":"'1.16.20260101':40 '4217':2,10,52,65 'access':22 'activ':36 'base':60 'code':28 'currenc':3,11,27,63 'current':24 'data':4,12 'date':59 'date-bas':58 'enum':18,67 'financ':66 'histor':26 'indic':55 'iso':1,9,51,64 'iso4217':6 'librari':7,34 'maintain':37 'modul':19 'name':29 'new':43 'numer':31 'offer':21 'provid':8 'python':14 'reflect':47 'regular':45 'releas':42 'repres':15 'scheme':62 'standard':53 'typic':54 'updat':48 'valu':32 'version':39,44,61","created_at":"2026-04-14T18:36:20.066915+00:00","updated_at":"2026-04-16T15:48:33.426985+00:00","problems":[{"fix":"Install the library using pip: `pip install iso4217`","cause":"The `iso4217` library is not installed in the Python environment, or the environment where the code is run does not have access to the installed package.","error":"ModuleNotFoundError: No module named 'iso4217'"},{"fix":"Ensure the currency code is a correct, three-letter uppercase ISO 4217 code. For example, to access the US Dollar, use `iso4217.Currency('USD')` or `iso4217.Currency.USD`.","cause":"This error occurs when attempting to create a `Currency` enum member or look up a currency by a code ('XYZ' in this example) that is not a recognized, valid ISO 4217 currency code within the library's dataset. This includes codes that are misspelled, do not exist, or are not in the expected three-letter uppercase format.","error":"ValueError: 'XYZ' is not a valid Currency"},{"fix":"Refer to the library's documentation to use the correct attribute names. Common attributes are `alpha3`, `currency_name`, `numeric_code`, `minor_unit`, and `country_name` (if applicable).","cause":"You are trying to access an attribute on a `Currency` enum member that does not exist. Users often guess attribute names or use incorrect casing (e.g., `iso4217.USD.code` instead of `iso4217.USD.alpha3`).","error":"AttributeError: 'Currency' object has no attribute 'some_invalid_attribute'"},{"fix":"To access historical or obsolete currencies, you might need to use a specific method or a separate collection provided by the library for historical data, if available. For current currencies, ensure you are using an up-to-date, active ISO 4217 code. The library's enum typically only includes currently active currencies directly.","cause":"This error specifically occurs when trying to access an obsolete currency code (like 'LTL' for Lithuanian Litas, which was replaced by EUR) directly as an attribute on the `iso4217.Currency` enum, assuming it should still be a direct member. By default, the `iso4217.Currency` enum primarily exposes *current* currency codes.","error":"AttributeError: type object 'Currency' has no attribute 'LTL'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.16.20260101","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/dahlia/iso4217","docs":null,"changelog":null,"pypi":"https://pypi.org/project/iso4217/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}