AttributeError in Python while creating FileCookieJar (cookielib Py 2.6)

I am trying to create a new FileCookieJar using cookielib in Python 2.6. However, when I do this, I get the following error:

Traceback (most recent call last):
  File "C:\Users\Paul\getfile.py", line 7, in <module>
cj.load(os.getcwd()+'\cookies.txt')
File "C:\Python26\lib\cookielib.py", line 1763, in load
self._really_load(f, filename, ignore_discard, ignore_expires)
AttributeError: FileCookieJar instance has no attribute '_really_load'

      

My code looks like this:

import cookielib, urllib2, os
cj = cookielib.FileCookieJar()
cj.load(os.getcwd()+'\cookies.txt')

      

I haven't used Python for years, but I need a small project. Can anyone please help?

+3


source to share


1 answer


FileCookieJar

is a kind of abstract class (i.e. has some functionality not implemented). You probably want to use one of its children - MozillaCookieJar

, MSIECookieJar

or LWPCookieJar

.



+5


source







All Articles