Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: Getting AppData folder in a cross-platform way

Tags:

I'd like a code snippet that gets the proper directory for app data (config files, etc) on all platforms (Win/Mac/Linux at least). For example: %APPDATA%/ on Windows.

like image 684
user1438098 Avatar asked Sep 29 '13 14:09

user1438098


People also ask

How do I access other Users AppData folder?

To open the AppData folder on Windows 10, 8 & 7: Open File Explorer/Windows Explorer. Type %AppData% into the address bar and hit enter. Navigate to the required folder (Roaming or Local)

What is the path for AppData?

AppData is a hidden folder located in C:\Users\<username>\AppData. The AppData folder contains custom settings and other information needed by applications.

What is local and Roaming in AppData?

Roaming folder contains data that can move with the user profile from a computer to a computer. Local folder contains data that cannot move with your user profile. LocalLow folder includes low-level access data, eg. temporary files of your browser when running in a protected mode.


1 Answers

If you don't mind using the appdirs module, it should solve your problem. (cost = you either need to install the module or include it directly in your Python application.)

like image 177
Jason S Avatar answered Oct 14 '22 14:10

Jason S