各位大佬,为什么我的itchat登录不了微信?(Python)
import itchat
itchat.login()
friends = itchat.get_friends(update=True)[0:] 

扫完码之后就报错误了,但是换别的微信又可以。

错误如下,求助。

 ---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-1-6ca89c573451> in <module>()
      1 import itchat
----> 2 itchat.login()
      3 friends = itchat.get_friends(update=True)[0:]

~\Anaconda3\lib\site-packages\itchat\components\login.py in login(self, enableCmdQR, picDir, qrCallback, loginCallback, exitCallback)
     71     self.web_init()
     72     self.show_mobile_login()
---> 73     self.get_contact(True)
     74     if hasattr(loginCallback, '__call__'):
     75         r = loginCallback()

~\Anaconda3\lib\site-packages\itchat\components\contact.py in get_contact(self, update)
    283     seq, memberList = 0, []
    284     while 1:
--> 285         seq, batchMemberList = _get_contact(seq)
    286         memberList.extend(batchMemberList)
    287         if seq == 0:

~\Anaconda3\lib\site-packages\itchat\components\contact.py in _get_contact(seq)
    279                 self.update_chatroom(chatroom['UserName'], detailedMember=True)
    280             return 0, []
--> 281         j = json.loads(r.content.decode('utf-8', 'replace'))
    282         return j.get('Seq', 0), j.get('MemberList')
    283     seq, memberList = 0, []

~\Anaconda3\lib\json\__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    352             parse_int is None and parse_float is None and
    353             parse_constant is None and object_pairs_hook is None and not kw):
--> 354         return _default_decoder.decode(s)
    355     if cls is None:
    356         cls = JSONDecoder

~\Anaconda3\lib\json\decoder.py in decode(self, s, _w)
    337 
    338         """
--> 339         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    340         end = _w(s, end).end()
    341         if end != len(s):

~\Anaconda3\lib\json\decoder.py in raw_decode(self, s, idx)
    355             obj, end = self.scan_once(s, idx)
    356         except StopIteration as err:
--> 357             raise JSONDecodeError("Expecting value", s, err.value) from None
    358         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

2个回答

itchat其实就是登陆网页版的微信,所以你可测试下用自己微信能不能在网页上登陆

itchat.auto_login()

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!