]> granicus.if.org Git - python/commitdiff
Use universal construct os.path.expanduser('~') instead of os.environ['HOME']
authorÉric Araujo <merwok@netwok.org>
Sat, 26 Mar 2011 00:24:47 +0000 (01:24 +0100)
committerÉric Araujo <merwok@netwok.org>
Sat, 26 Mar 2011 00:24:47 +0000 (01:24 +0100)
Doc/library/cookielib.rst
Doc/library/readline.rst

index 47211c9c0f186a7ca6923d95d71156f1d3b614fa..4ca04718762f1a3a06b040a6d55ef53a1d533db7 100644 (file)
@@ -750,7 +750,7 @@ cookies (assumes Unix/Netscape convention for location of the cookies file)::
 
    import os, cookielib, urllib2
    cj = cookielib.MozillaCookieJar()
-   cj.load(os.path.join(os.environ["HOME"], ".netscape/cookies.txt"))
+   cj.load(os.path.join(os.path.expanduser("~"), ".netscape", "cookies.txt"))
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
    r = opener.open("http://example.com/")
 
index f6e855e295da3b1e7801b0141e1f6da555dfc256..64c61a27501c75a850a660536a9155d18afd4c09 100644 (file)
@@ -211,7 +211,7 @@ normally be executed automatically during interactive sessions from the user's
 
    import os
    import readline
-   histfile = os.path.join(os.environ["HOME"], ".pyhist")
+   histfile = os.path.join(os.path.expanduser("~"), ".pyhist")
    try:
        readline.read_history_file(histfile)
    except IOError: