ModuleNotFoundError: No module named 'cookielib'

ModuleNotFoundError: No module named 'cookielib' and 'urllib2'

import urllib, urllib2, cookielib
username = 'yourusername'
password = 'yourpassword'
ck = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
loginn = urllib.urlencode({'username' : username, 'j_password' : password})
opener.open(' login_data)
resp = opener.open(')
resp.read()
print(resp) 

Now whenever I try to run python I get ImportError: no module named cookielib and urllib2. What happened? Please help me.

2

1 Answer

These two libraries are renamed / changed in python 3. this and this should help you out.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like