OS: WinXP, Python 2.4 latest version

I found it doesn't actually load cookies from the exist cookies.txt.
Instead, it generate a new one when visit that url. Who can help me
check what's problem in following code?

Many thanks in advance!

cj = cookielib.MozillaCookieJar()
cj.load("d:\\temp\\cookies.txt") # I want to use existing cookie
value, not new generated
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)

# then, user page
r = urllib2.urlopen("http://xxxxx_page_that_need_loaded_cookie";)
results = r.read()
open('user.html', 'w').write(results)

# save cookies to file
cj.save("./cookies") # with saved cookies, it is NOT the load one

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to