Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8375509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:11:44+00:00 2026-06-09T15:11:44+00:00

I’m working on a Python script that will constantly scrape data, but it will

  • 0

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.

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?

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?


Here’s the scenario:
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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:11:46+00:00Added an answer on June 9, 2026 at 3:11 pm

    Let me present you an alternative. It looks like you want real-time updates for some kind of information. You could use a pub/sub interface (publish/subscribe). Since you are using python, there are plenty of possibilities.

    One of them is using Redis pub/sub functionality: http://redis.io/topics/pubsub/ – and here is the corresponding python module: redis-py

    –Update–

    Example

    Here is an example from dirkk0 (question / answer):

    import sys
    import threading
    
    import cmd
    
    
    def monitor():
        r = redis.Redis(YOURHOST, YOURPORT, YOURPASSWORD, db=0)
    
        channel = sys.argv[1]
        p = r.pubsub()
    
        p.subscribe(channel)
    
        print 'monitoring channel', channel
        for m in p.listen():
            print m['data']
    
    
    class my_cmd(cmd.Cmd):
        """Simple command processor example."""
    
        def do_start(self, line):
            my_thread.start()
    
        def do_EOF(self, line):
            return True
    
    if __name__ == '__main__':
        if len(sys.argv) == 1:
            print "missing argument! please provide the channel name."
        else:
            my_thread = threading.Thread(target=monitor)
            my_thread.setDaemon(True)
    
            my_cmd().cmdloop()
    

    –Update 2–

    In addition, look at this tutorial:

    http://blog.abourget.net/2011/3/31/new-and-hot-part-6-redis-publish-and-subscribe/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.