API References¶
Documentation in this section is copied from documentation of QStandardPaths with minimal modification.
-
standardpaths.
configure
(application_name='', organization_name='')¶ Configure default application information used by PyStandardPaths.
See also
get_config()
andConfig
.
-
standardpaths.
get_config
()¶ Get the current configuration of application information.
Return type: Config
-
standardpaths.
get_writable_path
(location, config=None)¶ Get the directory where files of type should be written to. A
LocationError
is raised if the location cannot be determined.Return type: pathlib.Path
Note
The storage location returned can be a directory that does not exist; i.e., it may need to be created by the system or the user.
-
standardpaths.
get_standard_paths
(location, config=None)¶ Get all the directories where files of type belong.
The list of directories is sorted from high to low priority, starting with
get_writable_path()
if it can be determined. This list is empty if no locations for type are defined.Return type: pathlib.Path
See also
-
class
standardpaths.
Config
(application_name='', organization_name='')¶ Configuration class that holds application information.
See also
configure()
andget_config()
.
-
class
standardpaths.
LocationError
¶ Bases:
OSError
Exception class raised to indicate an error during path resolution.
-
class
standardpaths.
Location
¶ Bases:
enum.Enum
Describe the different locations that can be queried using functions such as
get_writable_path()
andget_standard_paths()
.Some of the values in this enum represent a user configuration. Such enum values will return the same paths in different applications, so they could be used to share data with other applications. Other values are specific to this application. Each enum value in the table below describes whether it’s application-specific or generic.
Application-specific directories should be assumed to be unreachable by other applications. Therefore, files placed there might not be readable by other applications, even if run by the same user. On the other hand, generic directories should be assumed to be accessible by all applications run by this user, but should still be assumed to be unreachable by applications by other users.
Data interchange with other users is out of the scope of PyStandardPaths.
-
app_data
= 17¶ A directory location where persistent application data can be stored. This is an application-specific directory. To obtain a path to store data to be shared with other applications, use
generic_data
. The returned path is never empty. On the Windows operating system, this returns the roaming path.
-
app_local_data
= None¶ The local settings path on the Windows operating system. On all other platforms, it returns the same value as
app_data
.
-
applications
= 3¶ The directory containing the user applications (either executables, application bundles, or shortcuts to them). This is a generic value. Note that installing applications may require additional, platform-specific operations. Files, folders or shortcuts in this directory are platform-specific.
-
cache
= 10¶ A directory location where user-specific non-essential (cached) data should be written. This is an application-specific directory. The returned path is never empty.
-
config
= 13¶ A directory location where user-specific configuration files should be written. This may be either a generic value or application-specific, and the returned path is never empty.
-
data
= 9¶ The same value as
app_local_data
. This enumeration value is deprecated. Usingapp_data
is preferable since on Windows, the roaming path is recommended.
-
desktop
= 0¶ The user’s desktop directory. This is a generic value.
-
documents
= 1¶ The directory containing user document files. This is a generic value. The returned path is never empty.
-
download
= 14¶ A directory for user’s downloaded files. This is a generic value. If no directory specific for downloads exists, a sensible fallback for storing user documents is returned.
-
fonts
= 2¶ The directory containing user’s fonts. This is a generic value. Note that installing fonts may require additional, platform-specific operations.
-
generic_cache
= 15¶ A directory location where user-specific non-essential (cached) data, shared across applications, should be written. This is a generic value. Note that the returned path may be empty if the system has no concept of shared cache.
-
generic_config
= 16¶ A directory location where user-specific configuration files shared between multiple applications should be written. This is a generic value and the returned path is never empty.
-
generic_data
= 11¶ A directory location where persistent data shared across applications can be stored. This is a generic value. The returned path is never empty.
-
home
= 8¶ The user’s home directory (the same as
os.path.expanduser('~')
). On Unix systems, this is equal to theHOME
environment variable. This value might be generic or application-specific, but the returned path is never empty.
-
log
= 'log'¶ A directory location where user-specific log files should be written. This is an application-specific value. The returned path is never empty.
-
movies
= 5¶ The directory containing the user’s movies and videos. This is a generic value. If no directory specific for movie files exists, a sensible fallback for storing user documents is returned.
-
music
= 4¶ The directory containing the user’s music or other audio files. This is a generic value. If no directory specific for music files exists, a sensible fallback for storing user documents is returned.
-
pictures
= 6¶ The directory containing the user’s pictures or photos. This is a generic value. If no directory specific for picture files exists, a sensible fallback for storing user documents is returned.
-
runtime
= 12¶ A directory location where runtime communication files should be written, like Unix local sockets. This is a generic value. The returned path may be empty on some systems.
-
temp
= 7¶ A directory where temporary files can be stored (the same as
tempfile.gettempdir()
). The returned value might be application-specific, shared among other applications for this user, or even system-wide. The returned path is never empty.
-