程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长

+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

python使用微信库wxpy报错问题解决

发布于2023-02-04 12:13     阅读(1062)     评论(0)     点赞(23)     收藏(0)


      今天安装python第三方微信库wxpy,网上吹的神乎其神,按耐不住好奇的心情,准备测试下相关功能。

    安装第三库

     pip install -U wxpy -i "https://pypi.doubanio.com/simple/"

  运行下列语句

  1. # 导入模块
  2. from wxpy import *
  3. # 初始化机器人,扫码登陆
  4. bot = Bot()

  出现二维码窗口,扫描登录

 结果出现错误提示:

Getting uuid of QR code.
Downloading QR code.
Please scan the QR code to log in.
Please press confirm on your phone.
Traceback (most recent call last):
  File "C:\Users\Administrator\PycharmProjects\holloProj\pro\1.wx\wxpy-test01.py", line 6, in <module>
    bot = Bot(cache_path=True)
  File "C:\Users\Administrator\PycharmProjects\holloProj\venv\lib\site-packages\wxpy\api\bot.py", line 83, in __init__
    self.core.auto_login(
  File "C:\Users\Administrator\PycharmProjects\holloProj\venv\lib\site-packages\itchat\components\register.py", line 29, in auto_login
    self.login(enableCmdQR=enableCmdQR, picDir=picDir, qrCallback=qrCallback,
  File "C:\Users\Administrator\PycharmProjects\holloProj\venv\lib\site-packages\itchat\components\login.py", line 48, in login
    status = self.check_login()
  File "C:\Users\Administrator\PycharmProjects\holloProj\venv\lib\site-packages\itchat\components\login.py", line 131, in check_login
    process_login_info(self, r.text)
  File "C:\Users\Administrator\PycharmProjects\holloProj\venv\lib\site-packages\itchat\components\login.py", line 164, in process_login_info
    for node in xml.dom.minidom.parseString(r.text).documentElement.childNodes:
  File "C:\Program Files\Python39\lib\xml\dom\minidom.py", line 1998, in parseString
    return expatbuilder.parseString(string)
  File "C:\Program Files\Python39\lib\xml\dom\expatbuilder.py", line 925, in parseString
    return builder.parseString(string)
  File "C:\Program Files\Python39\lib\xml\dom\expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
xml.parsers.expat.ExpatError: mismatched tag: line 64, column 4

Process finished with exit code 1

 翻阅资料,修改:

这个文件C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\itchat\utils.py

  1. def print_qr(fileDir):
  2. if config.OS == 'Darwin':
  3. subprocess.call(['open', fileDir])
  4. elif config.OS == 'Linux':
  5. subprocess.call(['xdg-open', fileDir])
  6. elif config.OS == 'Windows':
  7. # subprocess.call(['cmd', fileDir])
  8. # os.startfile(fileDir)
  9. webbrowser.open(fileDir)
  10. else:
  11. os.startfile(fileDir)

结果没有luan用,最总直接扫微信网页版,发现,已经不能用网页版登录微信了。看来微信已经关了相关的功能。我的微信是2015年申请的。

 

原文链接:https://blog.csdn.net/wendao_lx/article/details/127593715



所属网站分类: 技术文章 > 博客

作者:好难受

链接:https://www.pythonheidong.com/blog/article/1895594/7243d5d5c11698907af5/

来源:python黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

23 0
收藏该文
已收藏

评论内容:(最多支持255个字符)