Skip to content
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
Open
@zhiqihuang

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:
            .........

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions