How to exit python3 subprocess

Asked by At

I am started a subprocess in Python3:

# This will raise an exception if scrapy fails
# which is _probably_ a good idea in most scenarios
run(["scrapy", "crawl", "googlebook", "-a", "arg=" + json.dumps(urls)],check=True) 

The process query book info page by page,but in the middle of request(maybe page > 50),the response content is null.So I want to exit current subprocess and quit next pages request.And restart a new subprocess to request another keywords.How to exit current subprocess in the scrapy pipline processs?

0 Answers