python - AttributeError: 'NoneType' object has no attribute 'group' error -


try:             res = self.browser.open('https://login.facebook.com/login.php?login_attempt=1',form_data)             response = res.read()             self.fbid = re.search('https://www.facebook.com/(.*)\?sk=info',response)             self.fbid = re.search('https://www.facebook.com/(.*)',self.fbid.group(1))             self.fbid = re.search('https://www.facebook.com/(.*)',self.fbid.group(1))         except urllib2.httperror,e :             print "****exception****inside login  error code: %s" % (e.code)         res.close()     except urllib2.httperror,e :          print "****exception****inside login  error code: %s" % (e.code)      #print " server response code: %s " % (res.code) 

i got this

file "facebotv2.py", line 122, in login     self.fbid = re.search('https://www.facebook.com/(.*)',self.fbid.group(1)) attributeerror: 'nonetype' object has no attribute 'group' 

self.fbid none after first regular expression search. means didn't find match. if want prevent error, can conditionally continue searching result of initial search if self.fbid != none


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -