fate0 / pychrome

A Python Package for the Google Chrome Dev Protocol [threading base]
Other
612 stars 112 forks source link

连续运行3小时左右,程序就会卡死 #47

Open Cuile opened 4 years ago

Cuile commented 4 years ago

已经发生好几次,连续运行3小时左右,程序就会卡死,ctrl+c中止了程序,就得到了下面的报错信息,好像是线程超时了?

Traceback (most recent call last):
  File "test.py", line 174, in <module>
    test()
  File "test.py", line 122, in test
    r.script.load_jQuery_script("jquery-3.4.1.slim.min.js")
  File "/root/code/robot/script.py", line 37, in load_jQuery_script
    res = self.run_script(script, 3000)
  File "/root/code/robot/script.py", line 22, in run_script
    expression=script, returnByValue=True, timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/pychrome/tab.py", line 174, in call_method
    result = self._send({"method": _method, "params": kwargs}, timeout=timeout)
  File "/usr/local/lib/python3.7/site-packages/pychrome/tab.py", line 106, in _send
    return self.method_results[message['id']].get(timeout=q_timeout)
  File "/usr/local/lib/python3.7/queue.py", line 179, in get
    self.not_empty.wait(remaining)
  File "/usr/local/lib/python3.7/threading.py", line 300, in wait
    gotit = waiter.acquire(True, timeout)

我使用docker环境,python:3.7+alpeware/chrome-headless-stable:latest

yuhuan0311 commented 4 years ago

你好,能请教一下你的脚本是怎么运行起来的吗?我用作者项目里面的demo文件,运行的时候就会报错: (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x11026f510>: Failed to establish a new connection: [Errno 61] Connection refused')) 是不是还应该写些什么别的代码才能运行起来呢?

Cuile commented 4 years ago

你好,能请教一下你的脚本是怎么运行起来的吗?我用作者项目里面的demo文件,运行的时候就会报错: (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x11026f510>: Failed to establish a new connection: [Errno 61] Connection refused')) 是不是还应该写些什么别的代码才能运行起来呢?

你这个问题好难回答,不知道你现在什么环境