Getting the Appdata Directory with Python and PEP?

Eamonn Rea eamonnrea at gmail.com
Tue Nov 26 13:09:11 EST 2013


Thanks for the help on PEP, but I can't find a way to get the application support (appdata on Windows, no idea on Linux). If I do:

print os.environ['HOME']

I get: '/Users/eamonn', as that is my home directory. But when I do:

print os.environ['APPDATA']

I get an error. But when I do:

print os.getenv('APPDATA')

I get: None.

Apparently os.getenv() works on Windows, but I can't see a way to get this on Mac. If I could get the names of this for different OS's I could just check the OS and run the appropriate code.

Any help?



More information about the Python-list mailing list