471,079 Members | 1,064 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,079 software developers and data experts.

How to kill/stop a Thread?

Hi,

I like to do the following: Via http I get a stream of data and I like
to store this data with a python program. So what I need is to start the
downloading and to stop it after a given time. My aproach was to use:
urllib.urlretrieve("ULR","FILENAME")

It is fine! But how to stop the retrieving? Because it is a constant
stream of data there is no natural end. So I thought I use
treading.Thread to do it:

def retr():
urllib.urlretrieve("URL","FILENAME")

t=threading.Thread(target=retr)
t.start()

It's fine! The data is downloaded and I'm back in my program to do some
other stuff. BUT: I cannot stop the download. How can I achieve this?
(Another way of solution (w/o threading) would also helpful, of course!)
Thanks for your help,
Dirk

Mar 22 '06 #1
0 1336

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Jerry Sievers | last post: by
6 posts views Thread by RickDee | last post: by
4 posts views Thread by Bob Day | last post: by
2 posts views Thread by Christopher Carnahan | last post: by
3 posts views Thread by Thomas Dybdahl Ahle | last post: by
18 posts views Thread by =?Utf-8?B?VGhlU2lsdmVySGFtbWVy?= | last post: by
20 posts views Thread by =?ISO-8859-1?Q?Gerhard_H=E4ring?= | last post: by
7 posts views Thread by dmitrey | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.