rad icon indicating copy to clipboard operation
rad copied to clipboard

#爬虫爬着爬着就自己停了

Open zhangtianqing98 opened this issue 4 years ago • 2 comments

#爬虫爬着爬着就自己停了

zhangtianqing98 avatar Jan 22 '21 12:01 zhangtianqing98

多给点细节,要不我认为是爬虫太累了。

virusdefender avatar Jan 22 '21 13:01 virusdefender

【Python】Subprocess超时杀干净子进程【原创】.md_一直加班的程序猿-CSDN博客_python subprocess 超时 https://blog.csdn.net/jiandanokok/article/details/104853593/

p = subprocess.Popen(cmd_string, stderr=subprocess.STDOUT, start_new_session=True) format = 'gbk' try: (msg, errs) = p.communicate(timeout=timeout) ret_code = p.poll() if ret_code: code = 1 msg = "[Error]Called Error : " + str(msg.decode(format)) else: code = 0 msg = str(msg.decode(format)) except subprocess.TimeoutExpired: p.kill() p.terminate()

DixonHadden avatar Dec 26 '21 06:12 DixonHadden