{"id":23452,"library":"configparser2","title":"configparser2","description":"Backport of Python 3.5's configparser to older Python versions (2.6-3.5). Version 4.0.0 is the final release. Provides the updated ConfigParser with features like mapping protocol support, ordered dicts, and interpolation depth checking. Consider using Python 3's standard library configparser instead.","status":"deprecated","version":"4.0.0","language":"python","source_language":"en","source_url":"https://github.com/shubhamchaudhary/configparser2","tags":["configparser","backport","config","deprecated"],"install":[{"cmd":"pip install configparser2==4.0.0","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"May conflict with the standard library backport configparser; either can be imported, but mixing causes issues","package":"configparser","optional":false}],"imports":[{"note":"configparser is the stdlib backport name; configparser2 is the correct package name for this library.","wrong":"from configparser import ConfigParser","symbol":"ConfigParser","correct":"from configparser2 import ConfigParser"},{"note":"Old Python 2.x ConfigParser module was capitalized; configparser2 uses lower-case package name.","wrong":"from ConfigParser import SafeConfigParser","symbol":"SafeConfigParser","correct":"from configparser2 import SafeConfigParser"}],"quickstart":{"code":"from configparser2 import ConfigParser\nimport os\n\nconfig = ConfigParser()\nconfig.read_string(os.environ.get('CONFIG_STRING', '[DEFAULT]\\nkey=value\\n'))\nprint(dict(config['DEFAULT']))","lang":"python","description":"Minimal example using ConfigParser and environment variable for auth."},"warnings":[{"fix":"Switch to `import configparser` (stdlib backport) or upgrade to Python 3.","message":"configparser2 is no longer maintained. Use Python 3's standard library configparser instead, or the backport 'configparser' package if stuck on Python 2.","severity":"deprecated","affected_versions":"all"},{"fix":"Set `strict=False` when creating ConfigParser if you rely on duplicate key behavior: `ConfigParser(strict=False)`.","message":"In version 4.0.0, the `ConfigParser` class may have different default behavior for interpolation compared to older versions. Specifically, `strict` parameter defaults may break existing config files with duplicate keys.","severity":"breaking","affected_versions":"4.0.0"},{"fix":"Use a virtual environment to isolate projects, or avoid installing both packages simultaneously.","message":"Installing configparser2 will uninstall the standard library backport `configparser` due to package conflicts. This can break other tools that depend on the stdlib backport.","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":"Run `pip install configparser2==4.0.0` in the same Python environment where your script runs.","cause":"Package not installed or pip installed in wrong environment.","error":"ImportError: No module named configparser2"},{"fix":"Use `read()` or `read_string()` instead, or check docs for available methods.","cause":"Accessing method only available in Python 3's configparser; configparser2 may not have all modern methods.","error":"AttributeError: 'ConfigParser' object has no attribute 'read_file'"},{"fix":"Initialize with `ConfigParser(strict=False)` to allow duplicate keys (though not recommended).","cause":"The library version 4.0.0 defaults to `strict=True`, which raises on duplicate keys.","error":"ConfigParser.DuplicateSectionError: Key '...' with value '...' already exists"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}