{"id":9483,"library":"appdata","title":"Appdata Management Utilities","description":"The `appdata` library provides utilities for managing application-specific data folders across different operating systems (Windows, macOS, Linux). It helps locate standard directories for user data, configuration, and cache, ensuring cross-platform compatibility. The current version is 2.2.1, with releases typically occurring on an as-needed basis to address bugs or introduce minor enhancements.","status":"active","version":"2.2.1","language":"en","source_language":"en","source_url":"https://github.com/VoIlAlex/appdata","tags":["filesystem","appdata","paths","utilities","cross-platform"],"install":[{"cmd":"pip install appdata","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The `AppdataPaths` class was removed in version 2.0; use `AppData` instead, which consolidates its functionality.","wrong":"from appdata.appdata_paths import AppdataPaths","symbol":"AppData","correct":"from appdata import AppData"}],"quickstart":{"code":"import os\nfrom appdata import AppData\n\n# Replace 'MyAwesomeApp' and 'MyCompany' with your actual app/company names\nAPP_NAME = os.environ.get('APPDATA_APP_NAME', 'MyTestApp')\nAPP_AUTHOR = os.environ.get('APPDATA_APP_AUTHOR', 'MyTestCompany')\n\n# Initialize AppData for your application\napp_data = AppData(APP_NAME, APP_AUTHOR)\n\n# Access common application directories\nuser_data_dir = app_data.user_data_dir\nuser_config_dir = app_data.user_config_dir\nuser_cache_dir = app_data.user_cache_dir\n\nprint(f\"User Data Directory: {user_data_dir} (Type: {type(user_data_dir)})\")\nprint(f\"User Config Directory: {user_config_dir} (Type: {type(user_config_dir)})\")\nprint(f\"User Cache Directory: {user_cache_dir} (Type: {type(user_cache_dir)})\")\n\n# You can create subdirectories and files easily with pathlib.Path\nsome_file_path = user_data_dir / \"settings.json\"\nprint(f\"Example file path using pathlib: {some_file_path}\")\n\n# To convert to string for older APIs if needed:\nprint(f\"User data as string: {str(user_data_dir)}\")\n","lang":"python","description":"This quickstart demonstrates how to initialize `AppData` for your application and access the common user data, configuration, and cache directories. It highlights that the library returns `pathlib.Path` objects, which are flexible for path manipulation and can be converted to strings when necessary."},"warnings":[{"fix":"Migrate your code to use the `AppData` class. For example, replace `from appdata.appdata_paths import AppdataPaths` with `from appdata import AppData` and create an instance of `AppData`.","message":"The `AppdataPaths` class was completely removed in version 2.0.0. Its functionality was merged into the `AppData` class.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Update code that expects string results. `pathlib.Path` objects can be used directly for path manipulation (e.g., `path / 'filename.txt'`) or converted to strings using `str(path_object)` when interacting with APIs that require string paths.","message":"In version 2.0.0, the methods `user_data_dir`, `user_config_dir`, `user_cache_dir`, `site_data_dir`, and `site_config_dir` (and their equivalents) now return `pathlib.Path` objects instead of strings.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use the `/` operator for concatenating `pathlib.Path` objects with strings or other `Path` objects, or explicitly convert the `Path` object to a string first using `str(path_object)` if string concatenation is absolutely necessary.","message":"Attempting to concatenate a `pathlib.Path` object directly with a string using `+` will result in a `TypeError`.","severity":"gotcha","affected_versions":"All versions returning `pathlib.Path`"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Update your import statement to `from appdata import AppData` and refactor your code to use the `AppData` class instead.","cause":"Attempting to import the `AppdataPaths` class which was removed in `appdata` version 2.0.0.","error":"ModuleNotFoundError: No module named 'appdata.appdata_paths'"},{"fix":"Use the `/` operator provided by `pathlib` for path concatenation (e.g., `my_path / 'filename.txt'`) or convert the `pathlib.Path` object to a string first using `str(my_path)`.","cause":"This error occurs when you try to concatenate a `pathlib.Path` object (returned by `appdata` v2.0+) with a string using the `+` operator.","error":"TypeError: can only concatenate str (not \"PosixPath\") to str"},{"fix":"First, create an instance of `AppData` by calling it with your application name and author (e.g., `app_data = AppData('MyApplication', 'MyCompany')`), then access the attributes on that instance (e.g., `app_data.user_data_dir`).","cause":"You are trying to access instance attributes (like `user_data_dir`) directly on the `AppData` class without creating an instance first.","error":"AttributeError: type object 'AppData' has no attribute 'user_data_dir'"}]}