[New-bugs-announce] [issue11301] cookielib.LWPCookieJar.save() doesn't save cookies

Mike Cencula report at bugs.python.org
Wed Feb 23 21:50:27 CET 2011

New submission from Mike Cencula <mike at cencula.com>:

I'm trying to use cookielib.LWPCookieJar.save() to save cookies from a website.  The cookie file is created with a header line, but the cookies are not stored.  Example program attached.

Python version:
2.5.2 (r252:60911, Jan 24 2010, 14:53:14)

Running on Debian lenny as a guest on Virtualbox

Output from the attached file pasted below:
mike at debian:~$ python cookieexample2.py
Here are the headers of the page :
Server: none
Content-Type: text/html
Pragma: no-cache
Cache-Control: no-cache
Expires: Tue, 04 Dec 1993 21:29:02 GMT
Vary: Accept-Encoding
Date: Wed, 23 Feb 2011 20:43:55 GMT
Transfer-Encoding:  chunked
Connection: close
Connection: Transfer-Encoding

These are the cookies we have received so far :
0   :   <Cookie BIGipServerdiy_pool=604317450.20480.0000 for www.diy.co.uk/>
1   :   <Cookie BIGipServerdiy_pool=637871882.20480.0000 for www.diy.com/>
2   :   <Cookie DYN_USER_CONFIRM=1ab776eae0bf5661a2955c6ec7858439 for www.diy.com/>
3   :   <Cookie DYN_USER_ID=1619150879 for www.diy.com/>
mike at debian:~$

Contents of cookie.lwp afterward:
mike at debian:~$ cat cookies.lwp
mike at debian:~$

Behavior is nearly identical using cookielib.MozillaCookieJar except the headers are different in the saved cookie file.  Cookies themselves are not saved.

I am new to Python, so I hope this is not user error.

components: Library (Lib)
files: cookieexample2.py
messages: 129223
nosy: mcencula
priority: normal
severity: normal
status: open
title: cookielib.LWPCookieJar.save() doesn't save cookies
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file20868/cookieexample2.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list