Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60543

Re: Getting the Appdata Directory with Python and PEP?

Newsgroups comp.lang.python
Date 2013-11-26 14:49 -0800
References <50402350-c9cb-47be-b513-ad2fb7170187@googlegroups.com> <27870dae-87ff-4435-a2ff-a42f95c21d48@googlegroups.com> <5294f942$0$16012$e4fe514c@news.xs4all.nl>
Message-ID <2b6c4be1-e23f-488b-b64d-191d625dee46@googlegroups.com> (permalink)
Subject Re: Getting the Appdata Directory with Python and PEP?
From Eamonn Rea <eamonnrea@gmail.com>

Show all headers | View raw


On Tuesday, November 26, 2013 7:40:50 PM UTC, Irmen de Jong wrote:
> On 26-11-2013 19:09, Eamonn Rea wrote:
> 
> > 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?
> 
> > 
> 
> 
> 
> 
> 
> Maybe this module is of some use to you:
> 
> https://pypi.python.org/pypi/appdirs
> 
> 
> 
> It provides a unified Python API to the various OS specific 'user' directory locations.
> 
> 
> 
> Irmen

I saw this, but I wanted to do it myself as I stated in the OP :)

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Getting the Appdata Directory with Python and PEP? Eamonn Rea <eamonnrea@gmail.com> - 2013-11-25 12:48 -0800
  Re: Getting the Appdata Directory with Python and PEP? Andrew Berg <robotsondrugs@gmail.com> - 2013-11-25 15:10 -0600
  Re: Getting the Appdata Directory with Python and PEP? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-25 21:20 +0000
  Re: Getting the Appdata Directory with Python and PEP? Eamonn Rea <eamonnrea@gmail.com> - 2013-11-26 10:09 -0800
    Re: Getting the Appdata Directory with Python and PEP? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-26 13:52 -0500
    Re: Getting the Appdata Directory with Python and PEP? Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2013-11-26 20:40 +0100
      Re: Getting the Appdata Directory with Python and PEP? Eamonn Rea <eamonnrea@gmail.com> - 2013-11-26 14:49 -0800
        Re: Getting the Appdata Directory with Python and PEP? Chris Angelico <rosuav@gmail.com> - 2013-11-27 10:20 +1100
          Re: Getting the Appdata Directory with Python and PEP? Eamonn Rea <eamonnrea@gmail.com> - 2013-11-28 08:11 -0800
            Re: Getting the Appdata Directory with Python and PEP? Chris Angelico <rosuav@gmail.com> - 2013-11-29 04:28 +1100
            Re: Getting the Appdata Directory with Python and PEP? rusi <rustompmody@gmail.com> - 2013-11-28 10:32 -0800
            Re: Getting the Appdata Directory with Python and PEP? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-28 16:29 -0500
        Re: Getting the Appdata Directory with Python and PEP? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-26 23:21 +0000
        Re: Getting the Appdata Directory with Python and PEP? Kevin Walzer <kw@codebykevin.com> - 2013-12-02 09:39 -0500

csiph-web