title: Stop python script in infinite loop
body: <p>I'm working on a Python script that will constantly scrape data, but it will take quite a long time. Is there a safe way to stop a long running python script? The loop will run for more than 10 minutes and I need a way to stop it if I want, after it's already running.</p>
  
  <p>If I execute it from a cron job, then I'm assuming it'll just run until it's finished, so how do I stop it?</p>
  
  <p>Also, if I run it from a browser and just call the file. I'm assuming stopping the page from loading would halt it, correct?</p>
  
  <hr>
  
  <p><strong>Here's the scenario:</strong><br> I have one python script that is gather info from pages and put it into a queue. Then I want to have another python script that is in an infinite loop that just checks for new items in the queue. Lets say I want the infinite loop to begin at 8am and end at 8pm. How do I accomplish this?</p>