{"id":23962,"library":"liac-arff","title":"liac-arff","description":"liac-arff is a Python library for reading and writing ARFF (Attribute-Relation File Format) files, commonly used in WEKA machine learning toolkits. Current version 2.5.0 is the last to support Python 2. It supports sparse ARFF, data generators, and standard Java escape sequences. Release cadence is irregular, with about 1-2 releases per year.","status":"active","version":"2.5.0","language":"python","source_language":"en","source_url":"https://github.com/renatopp/liac-arff","tags":["arff","weka","data-mining","file-format"],"install":[{"cmd":"pip install liac-arff","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"symbol":"arff","correct":"import arff"},{"note":"load is a function in the arff module, not a top-level import. Import the module first.","wrong":"from arff import load","symbol":"load","correct":"data = arff.load(open('file.arff'))"}],"quickstart":{"code":"import arff\n\n# Load ARFF file\nwith open('example.arff') as f:\n    data = arff.load(f)\n    print(data['attributes'])\n    print(data['data'])\n\n# Load with generator (lazy loading)\nwith open('example.arff') as f:\n    for row in arff.load(f, return_type='generator'):\n        print(row)","lang":"python","description":"Load an ARFF file and access its attributes and data."},"warnings":[{"fix":"Use `with open('file.arff') as f: data = arff.load(f)`","message":"The `load()` function expects a file-like object, not a file path. Use `open()` or `io.StringIO`.","severity":"gotcha","affected_versions":"all"},{"fix":"Iterate over the generator first or use `list(data['data'])` to consume it, then access `data['attributes']`.","message":"When using `return_type='generator'`, the returned object is a generator that yields rows incrementally, but the `attributes` key is only available after the first iteration or after exhausting the generator. Accessing `data['attributes']` before iterating may raise an error or return an empty list.","severity":"gotcha","affected_versions":">=2.4.0"},{"fix":"Upgrade to Python 3.5+ or pin liac-arff to <=2.4.0.","message":"Python 2.7 support removed in version 2.5.0. Users on Python 2 must stay on version 2.4.0 or earlier.","severity":"breaking","affected_versions":">=2.5.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `import arff` then `data = arff.load(...)`","cause":"Attempting to import 'load' directly from arff (e.g., `from arff import load`) but the correct usage is to import the module and call arff.load.","error":"AttributeError: module 'arff' has no attribute 'load'"},{"fix":"Ensure you pass the file object to `arff.load()`, not the path. If a path is needed, open it first: `with open(path) as f: arff.load(f)`","cause":"Passing an open file handle where a path string is expected (often from mixing with other libraries).","error":"TypeError: expected str, bytes or os.PathLike object, not _io.BufferedReader"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}