This repository has been archived by the owner on Jan 13, 2020. It is now read-only.
This repository has been archived by the owner on Jan 13, 2020. It is now read-only.
get_friends问题 #3
Open
Description
Traceback (most recent call last):
File "/usr/local/bin/wexp", line 11, in
sys.exit(main())
File "/Library/Python/2.7/site-packages/we/run.py", line 52, in main
friends = wechat.get_friends()
File "/Library/Python/2.7/site-packages/we/wechat.py", line 81, in get_friends
label_list_str = re.search(label_pattern, row[13], re.MULTILINE).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
具体原因没有深究,但是可以通过修改条件避免Nonetype
def get_friends(self):
chat_db = self.path + '/%s/DB/MM.sqlite' % self.user_hash
logger.debug('DB path %s' % chat_db)
conn = sqlite3.connect(chat_db)
friends = []
for row in conn.execute('SELECT f.*,fe.ConStrRes2, fe.ConRemark FROM Friend as f JOIN Friend_Ext as fe USING(UsrName) WHERE `Type` NOT IN %s AND `UsrName` NOT LIKE "gh_%%"' % FriendTypeExlude.__str__()):
label_pattern = '<LabelList>(.*)</LabelList>'
if re.search(label_pattern, row[13], re.MULTILINE) == None:
pass
else:
.........
Metadata
Metadata
Assignees
Labels
No labels
Activity