python ichat使用学习记录

python

1.OSError: [WinError -2147221003] 找不到应用程序: 'D:\\python\\ichat\\qrcode.jpg'

原因是该库中没有windows系统如何打开二维码图片的处理方法。

解决问题的办法,详细的内容可参考 【https://blog.csdn.net/qq_21349669/article/details/78873193】

解决方法:
http://www.iplaypy.com/wenda/wd19142.html
打开这个文件C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\itchat\utils.py
导入import webbrowser模块,之后找到 def print_qr(fileDir):模块,修改这段代码,

def print_qr(fileDir):

if config.OS == 'Darwin':

subprocess.call(['open', fileDir])

elif config.OS == 'Linux':

subprocess.call(['xdg-open', fileDir])

elif config.OS == 'Windows':

#subprocess.call(['cmd', fileDir])

#os.startfile(fileDir)

webbrowser.open(fileDir)

else:

os.startfile(fileDir)

然后运行登录代码,即可打开浏览器,然后关闭浏览器,扫描生成的二维码图片即可登录成功。

 2.itchat.search_chatrooms()函数返回的列表值查询不到群聊,原因是:未将群聊保存到通讯录中。

测试时,发现有的时候能够发送群聊信息,结果有时发送不出去。因为未保存到通讯录中,只是临时的话,只有群聊信息正活跃时,才会获取到列表

以上是 python ichat使用学习记录 的全部内容, 来源链接: utcz.com/z/387718.html

回到顶部