pyspider启动错误解决(Python 3.7)
问题一
安装好pyspider之后,在启动的时候,报出上图错误。
原因
async和await从 python3.7 开始已经加入保留关键字中. 参考: What’s New In Python 3.7, 所以async不能作为函数的参数名.
解决办法
1.打开安装Python的位置:python位置\Lib\site-packages\pyspider
参照地址:D:\Anaconda\Lib\site-packages\pyspider
2.修改下列python文件中的async为shark(全部替换)
- run.py
- fetcher\tornado_fetcher.py
- webui\app.py
问题二
管理权限打开命令窗口,运行pyspider命令,报下列错
d:\anaconda\lib\site-packages\pyspider\libs\utils.py:196: FutureWarning: timeout is not supported on your platform. warnings.warn("timeout is not supported on your platform.", FutureWarning) [I 190504 11:20:38 result_worker:49] result_worker starting... phantomjs fetcher running on port 25555 [I 190504 11:20:46 processor:211] processor starting... [I 190504 11:20:46 scheduler:647] scheduler starting... [I 190504 11:20:46 scheduler:586] in 5m: new:0,success:0,retry:0,failed:0 [I 190504 11:20:48 tornado_fetcher:638] fetcher starting... [I 190504 11:20:49 scheduler:782] scheduler.xmlrpc listening on 127.0.0.1:23333 [I 190504 11:20:51 run:420] phantomjs exited. [I 190504 11:20:51 app:84] webui exiting... [I 190504 11:20:51 tornado_fetcher:671] fetcher exiting... [I 190504 11:20:52 scheduler:663] scheduler exiting... [I 190504 11:20:52 result_worker:66] result_worker exiting... [I 190504 11:20:52 processor:229] processor exiting... Traceback (most recent call last): File "d:\anaconda\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "d:\anaconda\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\Anaconda\Scripts\pyspider.exe\__main__.py", line 9, in <module> File "d:\anaconda\lib\site-packages\pyspider\run.py", line 754, in main cli() File "d:\anaconda\lib\site-packages\click\core.py", line 722, in __call__ return self.main(*args, **kwargs) File "d:\anaconda\lib\site-packages\click\core.py", line 697, in main rv = self.invoke(ctx) File "d:\anaconda\lib\site-packages\click\core.py", line 1043, in invoke return Command.invoke(self, ctx) File "d:\anaconda\lib\site-packages\click\core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "d:\anaconda\lib\site-packages\click\core.py", line 535, in invoke return callback(*args, **kwargs) File "d:\anaconda\lib\site-packages\click\decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "d:\anaconda\lib\site-packages\pyspider\run.py", line 165, in cli ctx.invoke(all) File "d:\anaconda\lib\site-packages\click\core.py", line 535, in invoke return callback(*args, **kwargs) File "d:\anaconda\lib\site-packages\click\decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "d:\anaconda\lib\site-packages\pyspider\run.py", line 497, in all ctx.invoke(webui, **webui_config) File "d:\anaconda\lib\site-packages\click\core.py", line 535, in invoke return callback(*args, **kwargs) File "d:\anaconda\lib\site-packages\click\decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "d:\anaconda\lib\site-packages\pyspider\run.py", line 384, in webui app.run(host=host, port=port) File "d:\anaconda\lib\site-packages\pyspider\webui\app.py", line 59, in run from .webdav import dav_app File "d:\anaconda\lib\site-packages\pyspider\webui\webdav.py", line 216, in <module> dav_app = WsgiDAVApp(config) File "d:\anaconda\lib\site-packages\wsgidav\wsgidav_app.py", line 135, in __init__ _check_config(config) File "d:\anaconda\lib\site-packages\wsgidav\wsgidav_app.py", line 119, in _check_config raise ValueError("Invalid configuration:\n - " + "\n - ".join(errors)) ValueError: Invalid configuration: - Deprecated option 'domaincontroller': use 'http_authenticator.domain_controller' instead.
原因
WsgiDAV发布了版本 pre-release 3.x导致
解决办法
降低WsgiDAV版本,命令窗口运行
python -m pip install wsgidav==2.4.1
管理权限打开命令窗口,运行pyspider命令,成功!