1、报错内容
[root@wrx crawlent]# python3 utils.py
Traceback (most recent call last):
File "/python3/crawlent/crawlentmaster/crawlent/jslcookie.py", line 60, in get_cookie
with open("jsl_cookie.txt","r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'jsl_cookie.txt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "utils.py", line 399, in <module>
cookies = jslck.get_cookie()
File "/python3/crawlent/crawlentmaster/crawlent/jslcookie.py", line 69, in get_cookie
self.set_cookie()
File "/python3/crawlent/crawlentmaster/crawlent/jslcookie.py", line 82, in set_cookie
self.get_js(html)
File "/python3/crawlent/crawlentmaster/crawlent/jslcookie.py", line 34, in get_js
script = self.execute_js(script,"decryptJs")
File "/python3/crawlent/crawlentmaster/crawlent/jslcookie.py", line 50, in execute_js
func = execjs.compile(js_string)
File "/usr/local/lib/python3.5/site-packages/execjs/__init__.py", line 61, in compile
return get().compile(source, cwd)
File "/usr/local/lib/python3.5/site-packages/execjs/_runtimes.py", line 21, in get
return get_from_environment() or _find_available_runtime()
File "/usr/local/lib/python3.5/site-packages/execjs/_runtimes.py", line 49, in _find_available_runtime
raise exceptions.RuntimeUnavailableError("Could not find an available JavaScript runtime.")
execjs._exceptions.RuntimeUnavailableError: Could not find an available JavaScript runtime.2、解决办法
#安装nodejs [root@wrx crawlent]# yum install nodejs -y Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : 1:libuv-0.10.34-1.el6.i686 1/2 Installing : nodejs-0.10.48-3.el6.i686 2/2 Verifying : nodejs-0.10.48-3.el6.i686 1/2 Verifying : 1:libuv-0.10.34-1.el6.i686 2/2 Installed: nodejs.i686 0:0.10.48-3.el6 Dependency Installed: libuv.i686 1:0.10.34-1.el6 Complete!