{"id":23278,"library":"arpy","title":"arpy","description":"arpy is a Python library for reading and writing Unix archive (ar) files, commonly used for static libraries (.a) and Debian packages (.deb). Version 2.3.0 supports Python 3.6+. It provides a simple interface to iterate over archive members and extract or add files.","status":"active","version":"2.3.0","language":"python","source_language":"en","source_url":"https://github.com/viraptor/arpy","tags":["ar","archive","unix","static-library","deb"],"install":[{"cmd":"pip install arpy","lang":"bash","label":"Install arpy from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"Archive","correct":"from arpy import Archive"}],"quickstart":{"code":"from arpy import Archive\n\nwith Archive('test.ar') as archive:\n    for entry in archive:\n        print(entry.name, entry.size)","lang":"python","description":"Open an existing ar file and list its members."},"warnings":[{"fix":"Explicitly call archive.close() after use, or upgrade to 2.3.0+.","message":"The Archive class context manager does not close the file on __exit__ in some versions; manually call .close() if needed.","severity":"gotcha","affected_versions":"<2.3.0"},{"fix":"Ensure data is bytes: archive.write(entry_name, b'data').","message":"Writing archives: the write() method expects bytes, not str. Passing a string will raise a TypeError.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'with Archive(...) as archive:' pattern. See docs.","message":"In version 2.0.0, the API changed from old-style (archive = Archive('file'); archive.read()) to context manager. Old code will break.","severity":"breaking","affected_versions":"<=1.x"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from arpy import Archive'.","cause":"Importing incorrectly, e.g., 'import arpy' then using arpy.Archive instead of from arpy import Archive.","error":"AttributeError: module 'arpy' has no attribute 'Archive'"},{"fix":"Encode string to bytes: archive.write('file.txt', 'content'.encode()).","cause":"Passing a string to Archive.write() instead of bytes.","error":"TypeError: write() argument must be a bytes-like object, not 'str'"},{"fix":"Check the file path exists, or create a new archive with mode='w'.","cause":"Trying to open a nonexistent archive for reading.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'test.ar'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}