ClientCookie bug (followup)

Mark Carter cartermark46 at ukmail.com
Sat Aug 16 05:31:14 EDT 2003


> I'll try it on a win 98 machine, and report back the results asap.

---
USERNAME

I promised that I would try getuser() on a win 98 machine. Alas,
typing:

import getpass
print getpass.getuser()

produces:

ImportError: No module named pwd

So, it's the same problem as occurs on win95 (unsuprisingly)

---
DELAYLOAD

John: Why without the delayload argument?

My response:

The following code:

import ClientCookie
c = ClientCookie.MSIECookieJar(delayload=1)
c.load_cookie_data("hemscott-cookie.bin")
import urllib2
url = 'http://businessplus.hemscott.net/corp/crp03733.htm'
request = urllib2.Request(url)
response = urllib2.urlopen(request)
request2 = urllib2.Request(url)
c.add_cookie_header(request2)
response2 = urllib2.urlopen(request2)
print response2.geturl()
print response2.info()  # headers
for line in response2.readlines():  # body
       print line


produces the error:

Traceback (most recent call last):
  File "C:\My Documents\markc\ClientCookie\clp04.py", line 9, in ?
    c.add_cookie_header(request2)
  File "C:\PYTHON23\Lib\site-packages\ClientCookie\_ClientCookie.py",
line 1170, in add_cookie_header
    cookies.extend(self._get_cookies_for_domain(
  File "C:\PYTHON23\Lib\site-packages\ClientCookie\_ClientCookie.py",
line 1050, in _get_cookies_for_domain
    return self._cookies_for_domain(domain, request, unverifiable)
  File "C:\PYTHON23\lib\site-packages\ClientCookie\_MSIECookieJar.py",
line 112, in _cookies_for_domain
    if self.delayload and cookies["//+delayload"] is not None:
KeyError: '//+delayload'

whereas running it without delayload=1 causes it to run successfully.




More information about the Python-list mailing list