Commit ef9c49e3 authored by Éric Araujo's avatar Éric Araujo

Use universal construct os.path.expanduser('~') instead of os.environ['HOME']

parent fde1e289
...@@ -750,7 +750,7 @@ cookies (assumes Unix/Netscape convention for location of the cookies file):: ...@@ -750,7 +750,7 @@ cookies (assumes Unix/Netscape convention for location of the cookies file)::
import os, cookielib, urllib2 import os, cookielib, urllib2
cj = cookielib.MozillaCookieJar() 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)) opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
r = opener.open("http://example.com/") r = opener.open("http://example.com/")
......
...@@ -211,7 +211,7 @@ normally be executed automatically during interactive sessions from the user's ...@@ -211,7 +211,7 @@ normally be executed automatically during interactive sessions from the user's
import os import os
import readline import readline
histfile = os.path.join(os.environ["HOME"], ".pyhist") histfile = os.path.join(os.path.expanduser("~"), ".pyhist")
try: try:
readline.read_history_file(histfile) readline.read_history_file(histfile)
except IOError: except IOError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment