解决wxpy发送中文文件报错问题

环境:

python3.6.5, win10

出错代码:

my_friend.send_file(‘D:\图片\图片.jpg’)

报错:

must be str, ResponseError

报错原因:

文件名含中文,编码问题

解决方法:

参考网址https://github.com/youfou/wxpy/issues/326
中一个大佬说的,把 https://github.com/littlecodersh/ItChat/tree/master/itchat
里面的itchat文件夹放在项目当前目录中。比如,我要运行的程序文件路径是:D:\自动化测试,那就要把itchat这个文件夹放在这个路径里。重新运行程序,就不会报错了。

PS:

遇到无法发送大文件问题时,运行命令行pip install --upgrade itchat更新一下。(网页版微信据说最大只能发送2M的文件)

猜你喜欢

转载自blog.csdn.net/qq_37088317/article/details/89082720