Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'subject:Getting': 0.07; 'subject:PEP': 0.07; 'closest': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'skip:% 20': 0.09; 'windows,': 0.09; 'windows': 0.15; 'linux).': 0.16; 'message-id:@4ax.com': 0.16; 'none.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'appropriate': 0.16; 'code.': 0.18; 'variable': 0.18; 'directory.': 0.24; 'skip:% 10': 0.24; 'unix/linux': 0.24; 'url:home': 0.24; 'login': 0.25; 'header:X-Complaints-To:1': 0.27; 'idea': 0.28; '----': 0.29; 'expanding': 0.29; "doesn't": 0.30; '(which': 0.31; "skip:' 10": 0.31; 'relies': 0.31; 'skip:c 30': 0.32; 'run': 0.32; '-----': 0.33; 'beginning': 0.33; 'subject:the': 0.34; 'could': 0.34; 'subject:with': 0.35; "can't": 0.35; 'skip:u 20': 0.35; 'but': 0.35; 'impression': 0.36; 'charset :us-ascii': 0.36; 'subject:?': 0.36; 'error.': 0.37; 'application': 0.37; 'being': 0.38; 'skip:o 20': 0.38; 'initially': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'name': 0.63; 'different': 0.65; 'home': 0.69; 'skip:a 40': 0.72; 'do:': 0.91; 'received:108': 0.93; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Getting the Appdata Directory with Python and PEP? Date: Tue, 26 Nov 2013 13:52:12 -0500 Organization: IISS Elusive Unicorn References: <50402350-c9cb-47be-b513-ad2fb7170187@googlegroups.com> <27870dae-87ff-4435-a2ff-a42f95c21d48@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-73-119-194.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 66 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385491930 news.xs4all.nl 15937 [2001:888:2000:d::a6]:50783 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60534 On Tue, 26 Nov 2013 10:09:11 -0800 (PST), Eamonn Rea declaimed the following: >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. > APPDATA is a Windows conceit... My impression is that UNIX/Linux relies upon dot-directories (file/directory names beginning with a . being automatically hidden). ~/.myAppData and ~ expanding to the login home directory... Note that my Windows system doesn't /have/ a HOME variable C:\Users\Wulfraed\Documents>set appdata APPDATA=C:\Users\Wulfraed\AppData\Roaming C:\Users\Wulfraed\Documents>set home HOMEDRIVE=C: HOMEPATH=\Users\Wulfraed C:\Users\Wulfraed\Documents>set userprofile USERPROFILE=C:\Users\Wulfraed C:\Users\Wulfraed\Documents> The closest is USERPROFILE (which is initially %HOMEDRIVE%%HOMEPATH%) C:\Users\Wulfraed\Documents>echo %userprofile% C:\Users\Wulfraed C:\Users\Wulfraed\Documents>echo %homedrive%%homepath% C:\Users\Wulfraed PowerShell, OTOH PS C:\Users\Wulfraed\Documents> Get-Variable home Name Value ---- ----- HOME C:\Users\Wulfraed -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/