Command Line Report

Running python -m platformdirs prints every directory platformdirs would use on the current machine, for a sample application. It is the quickest way to check what a platform, an environment variable or a user's setup does to the paths, and a useful thing to ask for in bug reports. This page describes the command, its output format and how to adapt it to your own app name.

Usage

python -m platformdirs

The command takes no arguments or options; anything passed after it is ignored. It uses the app name MyApp and the author MyCompany, and prints:

  1. A header line with the installed version: -- platformdirs 4.14.9 --.
  2. Four sections, each listing all 27 directories as property: value:
Section header Object used
-- app dirs (with optional 'version') PlatformDirs("MyApp", "MyCompany", version="1.0")
-- app dirs (without optional 'version') PlatformDirs("MyApp", "MyCompany")
-- app dirs (without optional 'appauthor') PlatformDirs("MyApp")
-- app dirs (with disabled 'appauthor') PlatformDirs("MyApp", appauthor=False)

Sections are separated by a blank line. All other parameters keep their defaults (roaming=False, multipath=False, opinion=True, ensure_exists=False, use_site_for_root=False), so the command never creates a directory.

Output Order

Within each section the properties appear in this fixed order:

user_data_dir
user_config_dir
user_cache_dir
user_state_dir
user_log_dir
user_documents_dir
user_downloads_dir
user_pictures_dir
user_videos_dir
user_music_dir
user_desktop_dir
user_projects_dir
user_publicshare_dir
user_templates_dir
user_fonts_dir
user_preference_dir
user_bin_dir
site_bin_dir
user_applications_dir
user_runtime_dir
site_data_dir
site_config_dir
site_cache_dir
site_state_dir
site_log_dir
site_applications_dir
site_runtime_dir

Example: Windows

This is the first section of a real run on Windows 11, with the user name replaced by <User>:

-- platformdirs 4.14.9 --
-- app dirs (with optional 'version')
user_data_dir: C:\Users\<User>\AppData\Local\MyCompany\MyApp\1.0
user_config_dir: C:\Users\<User>\AppData\Local\MyCompany\MyApp\1.0
user_cache_dir: C:\Users\<User>\AppData\Local\MyCompany\MyApp\Cache\1.0
user_state_dir: C:\Users\<User>\AppData\Local\MyCompany\MyApp\1.0
user_log_dir: C:\Users\<User>\AppData\Local\MyCompany\MyApp\1.0\Logs
user_documents_dir: C:\Users\<User>\Documents
user_downloads_dir: C:\Users\<User>\Downloads
user_pictures_dir: C:\Users\<User>\Pictures
user_videos_dir: C:\Users\<User>\Videos
user_music_dir: C:\Users\<User>\Music
user_desktop_dir: C:\Users\<User>\Desktop
user_projects_dir: C:\Users\<User>\Projects
user_publicshare_dir: C:\Users\Public
user_templates_dir: C:\Users\<User>\AppData\Roaming\Microsoft\Windows\Templates
user_fonts_dir: C:\Users\<User>\AppData\Local\Microsoft\Windows\Fonts
user_preference_dir: C:\Users\<User>\AppData\Local\MyCompany\MyApp\1.0
user_bin_dir: C:\Users\<User>\AppData\Local\Programs
site_bin_dir: C:\ProgramData\bin
user_applications_dir: C:\Users\<User>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
user_runtime_dir: C:\Users\<User>\AppData\Local\Temp\MyCompany\MyApp\1.0
site_data_dir: C:\ProgramData\MyCompany\MyApp\1.0
site_config_dir: C:\ProgramData\MyCompany\MyApp\1.0
site_cache_dir: C:\ProgramData\MyCompany\MyApp\Cache\1.0
site_state_dir: C:\ProgramData\MyCompany\MyApp\1.0
site_log_dir: C:\ProgramData\MyCompany\MyApp\1.0\Logs
site_applications_dir: C:\ProgramData\Microsoft\Windows\Start Menu\Programs
site_runtime_dir: C:\Users\<User>\AppData\Local\Temp\MyCompany\MyApp\1.0

Comparing the four sections shows the effect of version and appauthor. The user_data_dir line from each section of the same run:

Section user_data_dir
with optional version C:\Users\<User>\AppData\Local\MyCompany\MyApp\1.0
without optional version C:\Users\<User>\AppData\Local\MyCompany\MyApp
without optional appauthor C:\Users\<User>\AppData\Local\MyApp\MyApp
with disabled appauthor C:\Users\<User>\AppData\Local\MyApp

The third row shows the doubled folder you get on Windows when appauthor is left as None; see Windows.

Example: Linux

On Linux the first section looks similar to the following (illustrative, derived from the code for a user <user> with UID 1000, no XDG variables set and a running login session):

-- platformdirs 4.14.9 --
-- app dirs (with optional 'version')
user_data_dir: /home/<user>/.local/share/MyApp/1.0
user_config_dir: /home/<user>/.config/MyApp/1.0
user_cache_dir: /home/<user>/.cache/MyApp/1.0
user_state_dir: /home/<user>/.local/state/MyApp/1.0
user_log_dir: /home/<user>/.local/state/MyApp/1.0/log
user_documents_dir: /home/<user>/Documents
...
user_runtime_dir: /run/user/1000/MyApp/1.0
site_data_dir: /usr/local/share/MyApp/1.0
site_config_dir: /etc/xdg/MyApp/1.0
site_cache_dir: /var/cache/MyApp/1.0
site_state_dir: /var/lib/MyApp/1.0
site_log_dir: /var/log/MyApp/1.0
site_applications_dir: /usr/local/share/applications
site_runtime_dir: /run/MyApp/1.0

appauthor has no effect on Linux, so the last two sections are identical to the second.

Errors in the Output

The report is meant to work even on a misconfigured machine. If reading a property raises PermissionError or RuntimeError (for example an unknown home directory, or an unsafe temporary runtime directory on Unix), the error message is printed in place of the path and the report continues:

user_runtime_dir: runtime directory /tmp/runtime-1000 is owned by uid 1001, not 1000; set XDG_RUNTIME_DIR instead

(Illustrative; the exact text depends on the problem found.) A RuntimeDirWarning about XDG_RUNTIME_DIR may also appear on standard error, once per distinct message. Other exceptions are not caught.

Checking Your Own App

The report always uses MyApp/MyCompany. To see the paths for your own settings, print the properties yourself:

python -c "from platformdirs import PlatformDirs; d = PlatformDirs('SuperApp', 'Acme', version='2.0'); print(d.user_data_dir, d.user_cache_dir, d.user_log_dir, sep='\n')"

See Also