Reply
Thread Tools
Posts: 95 | Thanked: 16 times | Joined on Feb 2008
#1
1.Can someone tell me or give me an example of how to download a file using python?
2.Can someone give me an example of opening another program in python?
3.Where does python get installed to?

also im using an n810 with pygtkeditor and python for maemo installed.
 
zeez's Avatar
Posts: 341 | Thanked: 68 times | Joined on Aug 2007
#2
1: Check out urllib or urllib2
2: Check out commands
3: Usually /usr/bin/ but that might depend on your dist.
 

The Following User Says Thank You to zeez For This Useful Post:
Posts: 95 | Thanked: 16 times | Joined on Feb 2008
#3
Originally Posted by zeez View Post
1: Check out urllib or urllib2
2: Check out commands
3: Usually /usr/bin/ but that might depend on your dist.
Thanks would you happen to know how to use urllib.urlretrieve(url,file) and make it return the progress of the download?
 
Posts: 87 | Thanked: 98 times | Joined on Oct 2007 @ Austria
#4
Originally Posted by MerkurAlex View Post
Thanks would you happen to know how to use urllib.urlretrieve(url,file) and make it return the progress of the download?
Look here:

Code:
>>> import urllib
>>> def report_progress(count, size, total):
...     print "downloaded", (count*size), "bytes of", total
... 
>>> urllib.urlretrieve("http://www.maemo.org/", "maemo.html", report_progress)
downloaded 0 bytes of -1
downloaded 8192 bytes of -1
downloaded 16384 bytes of -1
('maemo.html', <httplib.HTTPMessage instance at 0xb7640bac>)
>>>
 
Reply


 
Forum Jump


All times are GMT. The time now is 17:46.