youfou / wxpy

微信机器人 / 可能是最优雅的微信个人号 API ✨✨
http://wxpy.readthedocs.io
MIT License
13.96k stars 2.38k forks source link

python2.7 FileNotFoundError #105

Open myhelloos opened 7 years ago

myhelloos commented 7 years ago

使用python2.7 运行bot = Bot()报错

   File "/Users/alfred_yuan/git/shark-robot/weixin_robot/run.py", line 11, in main
    bot = Bot(console_qr=True)
  File "/Users/alfred_yuan/git/shark-robot/shark-venv/lib/python2.7/site-packages/wxpy/api/bot.py", line 88, in __init__
    except FileNotFoundError as e:
NameError: global name 'FileNotFoundError' is not defined
Imccccc commented 7 years ago

python2 里面并没有FileNotFoundError。应该改成IOError会更好点

diqigan commented 7 years ago

我也碰到了同样的问题,昨天还是可以正常运行的,代码哪都没改今天再运行就提示: E:\Python27\python.exe D:/wxpyTest/src/test.py 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 "D:/wxpyTest/src/test.py", line 5, in bot = Bot() File "E:\Python27\lib\site-packages\wxpy\api\bot.py", line 88, in init except FileNotFoundError as e: NameError: global name 'FileNotFoundError' is not defined

Process finished with exit code 1

iv3n0m commented 7 years ago

我也遇到这种问题然后也无法登录微信web端,是被封了吗

diqigan commented 7 years ago

我换成Python 3试了下,报错提示变成了 KeyError: 'pass_ticket'。 从其它回答中看到了相同问题,这种情况确实是被封了。

xuhang57 commented 6 years ago

可以试一试:bot = Bot(console_qr=True)

Penny7088 commented 6 years ago

可以试一试:bot = Bot(console_qr=True) 加上参数还是报错 Traceback (most recent call last): File "/Users/penny/PycharmProjects/wxpyDemo/wxBot.py", line 13, in main() File "/Users/penny/PycharmProjects/wxpyDemo/wxBot.py", line 7, in main bot = Bot(console_qr=True); File "/Users/penny/venv/wxpyDemo/lib/python2.7/site-packages/wxpy/api/bot.py", line 88, in init except FileNotFoundError as e: NameError: global name 'FileNotFoundError' is not defined

ShanChuangxin commented 6 years ago

可以试一试:bot = Bot(console_qr=True) 亲测可以,应该是因为当前系统没法显示二维码造成的

edidada commented 5 years ago

Linux centos 7 3.10.0-514.26.2.el7.x86_64 Traceback (most recent call last): File "test.py", line 4, in bot = Bot(console_qr=True) File "/usr/lib/python2.7/site-packages/wxpy/api/bot.py", line 88, in init except FileNotFoundError as e: NameError: global name 'FileNotFoundError' is not defined [root@iz2zec6u1iybgfepo5fucrz ~]# uname -a Linux iz2zec6u1iybgfepo5fucrz 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

ShoJinto commented 5 years ago

In [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.

---------------------------------------------------------------------------

NameError Traceback (most recent call last)

in () ----> 1 bot = Bot() c:\users\xxx\.virtualenvs\pywechat-g3i5pea4\lib\site-packages\wxpy\api\bot.pyc in __init__(self, cache_path, console_qr, qr_path, qr_callback, login_callback, logout_callback) 86 loginCallback=login_callback, exitCallback=logout_callback 87 ) ---> 88 except FileNotFoundError as e: 89 if 'xdg-open' in e.strerror: 90 raise Exception('use `console_qr` arg while under pure console environment') NameError: global name 'FileNotFoundError' is not defined 这个问题怎么解决呀!! 我登陆了一次,然后 bot.logout() ,再进行bot=Bot() 就报错了。ISSUE 挂着好几个月了呀!有人解决了么?
ShoJinto commented 5 years ago

In [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.

---------------------------------------------------------------------------

NameError Traceback (most recent call last) in () ----> 1 bot = Bot()

c:\users\xxx.virtualenvs\pywechat-g3i5pea4\lib\site-packages\wxpy\api\bot.pyc in init(self, cache_path, console_qr, qr_path, qr_callback, login_callback, logout_callback) 86 loginCallback=login_callback, exitCallback=logout_callback 87 ) ---> 88 except FileNotFoundError as e: 89 if 'xdg-open' in e.strerror: 90 raise Exception('use console_qr arg while under pure console environment')

NameError: global name 'FileNotFoundError' is not defined

这个问题怎么解决呀!! 我登陆了一次,然后 bot.logout() ,再进行bot=Bot() 就报错了。ISSUE 挂着好几个月了呀!有人解决了么?

经过实践,证明所有的Bot都被微信给屏蔽了。

caihy05 commented 4 years ago

bot = Bot(console_qr=True)出现二维码,就是二维码太大了