-1

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('https://login.facebook.com/login.php?login_attempt=1', login_data)

resp = opener.open('http://www.facebook.com/')

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.

1 Answers1

1

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

mojosama
  • 11
  • 2