python cookiejar: CookieJar instance has no attribute 'load'
Question: I am quite new to python and I am trying to set a cookie using the `cookielib`
library of python, like so:

    
    
    >>> import cookielib
    >>> cj = cookielib.CookieJar()
    >>> cj.load('cookies.txt')
    

and I get thrown this error:

    
    
    Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
    AttributeError: CookieJar instance has no attribute 'load'
    

I think the same code used to work earlier, but I am entirely unsure why this
is happening now.


Answer: [`load()`](https://docs.python.org/2/library/cookielib.html#cookielib.FileCookieJar.load)
is a method on the _[`FileCookieJar()`
class](https://docs.python.org/2/library/cookielib.html#cookielib.FileCookieJar)_
only, a subclass of
[`CookieJar()`](https://docs.python.org/2/library/cookielib.html#cookielib.CookieJar).

Looks like you got confused between the two somewhere.

The following works:

    
    
    import cookielib
    cj = cookielib.FileCookieJar()
    cj.load('cookies.txt')
    

