wxpy icon indicating copy to clipboard operation
wxpy copied to clipboard

python2.7 FileNotFoundError

Open myhelloos opened this issue 7 years ago • 11 comments

使用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

myhelloos avatar Jun 30 '17 09:06 myhelloos

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

Imccccc avatar Jul 02 '17 16:07 Imccccc

我也碰到了同样的问题,昨天还是可以正常运行的,代码哪都没改今天再运行就提示: 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

diqigan avatar Aug 09 '17 09:08 diqigan

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

iv3n0m avatar Aug 10 '17 15:08 iv3n0m

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

diqigan avatar Aug 11 '17 03:08 diqigan

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

xuhang57 avatar Oct 11 '17 18:10 xuhang57

可以试一试: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

Penny7088 avatar Apr 04 '18 03:04 Penny7088

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

ShanChuangxin avatar Apr 16 '18 03:04 ShanChuangxin

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

edidada avatar Nov 23 '18 02:11 edidada

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 avatar Apr 02 '19 06:04 ShoJinto

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都被微信给屏蔽了。

ShoJinto avatar Apr 02 '19 07:04 ShoJinto

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

caihy05 avatar Apr 01 '20 07:04 caihy05