You Are Here:

Community: Developer Discussion Boards

#1 Old How to cancel an ongoing download? - 2008-09-27, 22:04

Join Date: Mar 2007
Posts: 153
novis
Offline
Regular Contributor
Hello,
is there a way to savely cancel an ongoing download?
(e.g. because due to a poor network the download takes too long).

I started a download with:
Code:
res = urllib.urlretrieve(img_url,"e:\\test.png",hook)
How can I achieve it?

Thx
novis
Reply With Quote

#2 Old Re: How to cancel an ongoing download? - 2008-09-27, 22:18

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
There doesn't seem to be any standard way to do that. Nothing related is said in the urllib documentation and a Google search only returned this discussion, which doesn't have a clear conclusion.
Reply With Quote

#3 Old Re: How to cancel an ongoing download? - 2008-09-27, 22:41

Join Date: Mar 2007
Posts: 153
novis
Offline
Regular Contributor
Hello bogdan.galiceanu,
thx for the fast reply.
I also couldn't find a save solution in the python docs.

The only but dirty solution that comes to my mind is this:
I'll run the download in a thread. When I want to cancel the download, I just throw an exception in the "reporthook" function.

Not nice but there seems to be no better way.

cu
novis
Reply With Quote

#4 Old Re: How to cancel an ongoing download? - 2008-09-27, 23:16

Join Date: Mar 2003
Posts: 937
Location: Espoo, Finland
JOM's Avatar
JOM
Offline
Forum Nokia Champion
Quote:
Originally Posted by novis View Post
The only but dirty solution that comes to my mind is this:
I'll run the download in a thread. When I want to cancel the download, I just throw an exception in the "reporthook" function.
There must be nasty side-effects to PyS60 environment from such violent action! Howabout socket.close() or access_point.stop(), can you do either of those?

Cheers,

--jouni
Reply With Quote

#5 Old Re: How to cancel an ongoing download? - 2008-09-28, 04:22

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
Quote:
Originally Posted by novis View Post
Hello,
is there a way to savely cancel an ongoing download?
(e.g. because due to a poor network the download takes too long).
HI novis

actually you can try a thing if you feel that the download is bad due to network connection. Then detect the strength of the network using the sysagent module and once it goes a predefined low limit then close your active connection by this. article.

Just a hint.

Enjoy Pythoning
Gaba88


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#6 Old Re: How to cancel an ongoing download? - 2008-09-28, 16:20

Join Date: Mar 2007
Posts: 153
novis
Offline
Regular Contributor
Hi JOM,
unfortunately using "access_point.stop()" does not abort ongoing downloads.

thx gaba88,
checking the signal strength proofed to be not very reliable (especially in 3G networks).
Moreover the returned signal strength of nokia devices is not "real time measured". The returned signal strength seems to be averaged over a certain amount of time. And, you can still loose network during a download.

For any case, it'd be more then useful to have the option to cancel an ongoing download.
So far, I was searching the net to find a solution but without success.

Maybe a download expert might give us a hint

Thx
novis
Reply With Quote

#7 Old Re: How to cancel an ongoing download? - 2008-09-28, 17:57

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
Quote:
Originally Posted by novis View Post

thx gaba88,
checking the signal strength proofed to be not very reliable (especially in 3G networks).
Moreover the returned signal strength of nokia devices is not "real time measured". The returned signal strength seems to be averaged over a certain amount of time. And, you can still loose network during a download.

Thx
novis
Hi Novis
really sad that it didnt worked for you. And you are correct that the network signal returned is not the real time signal.
And its more sad for you as i also searched bit and found nothing on how to cancel the download .

Regards
Gaba88


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#8 Old Re: How to cancel an ongoing download? - 2008-09-28, 18:17

Join Date: Mar 2007
Posts: 153
novis
Offline
Regular Contributor
"Dont let the system bring you down."
I'm sure there is a solution out there.

We just need to find it.

cu
novis
Reply With Quote

#9 Old Re: How to cancel an ongoing download? - 2008-09-28, 18:22

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
Quote:
Originally Posted by novis View Post
"Dont let the system bring you down."
I'm sure there is a solution out there.

We just need to find it.

cu
novis
ya thats correct. hope any one of us reaches to a quick and efficient solution.

Enjoy Pythoning
Gaba88


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#10 Old Re: How to cancel an ongoing download? - 2008-09-29, 07:30

Join Date: Jan 2004
Posts: 368
Location: Helsinki
Send a message via Skype™ to miohtama
miohtama's Avatar
miohtama
Offline
Regular Contributor
Check urlgrabber library.


Mikko Ohtamaa
Twinapex Research
http://www.twinapex.com
Reply With Quote

#11 Old Re: How to cancel an ongoing download? - 2008-10-01, 12:22

Join Date: Sep 2008
Posts: 115
Location: Bhavnagar
Send a message via MSN to jalpesh_patel17 Send a message via Yahoo to jalpesh_patel17
jalpesh_patel17's Avatar
jalpesh_patel17
Offline
Regular Contributor
Quote:
Originally Posted by gaba88 View Post
ya thats correct. hope any one of us reaches to a quick and efficient solution.
miohtama give u r8 sug
Check urlgrabber library.

tnks
Reply With Quote

#12 Old Re: How to cancel an ongoing download? - 2008-10-01, 15:46

Join Date: Feb 2008
Posts: 6
timoriensis
Offline
Registered User
Quote:
Originally Posted by jalpesh_patel17 View Post
miohtama give u r8 sug
Check urlgrabber library.
that library looks nice but just stupid basic question, how to import it?

I tried to use these steps:
http://wiki.forum.nokia.com/index.ph...tall_libraries
http://www.nbl.fi/~nbl928/README-0.27.txt
etc
(I tried first without signing and without capabilities because assuming that getting running is not needing those, only getting it working correctly. right?


and even if easy to make sis file of the whole directory (only *.py files in \resource directory) and to install it but then when trying to call those in the phone (used urlgrabber.py as main) then seems that import not yet working.
Reply With Quote

#13 Old Re: How to cancel an ongoing download? - 2008-10-01, 18:57

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Put the library files in C:\Resource or any folder and append that path.

Use this code:

Quote:
import sys
sys.path.append('C:\Resource')
The import should work then.

Best Regards,
Croozeus
Reply With Quote

#14 Old Re: How to cancel an ongoing download? - 2008-10-01, 20:00

Join Date: Mar 2007
Posts: 153
novis
Offline
Regular Contributor
mmm,
nice library indeed. Thx 2 miohtama
Many nice features.
But no possibility to cancel an ongoing download in that library either.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Download Application and Technology arizkohli General Browsing 0 2003-06-27 16:16
Download Application and Technology arizkohli General Symbian C++ 0 2003-06-27 16:14

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia