questions about multiprocessing
Vincent Ren
renws1990 at gmail.com
Fri Mar 4 23:08:21 EST 2011
Hello, everyone, recently I am trying to learn python's
multiprocessing, but
I got confused as a beginner.
If I run the code below:
from multiprocessing import Pool
import urllib2
otasks = [
'http://www.php.net'
'http://www.python.org'
'http://www.perl.org'
'http://www.gnu.org'
]
def f(url):
return urllib2.urlopen(url).read()
pool = Pool(processes = 2)
print pool.map(f, tasks)
I'll receive this message:
Traceback (most recent call last):
File "<stdin>", line 14, in <module>
File "/usr/lib/python2.6/multiprocessing/pool.py", line 148, in map
return self.map_async(func, iterable, chunksize).get()
File "/usr/lib/python2.6/multiprocessing/pool.py", line 422, in get
raise self._value
httplib.InvalidURL: nonnumeric port: ''
I run Python 2.6 on Ubuntu 10.10
Regards
Vincent
More information about the Python-list
mailing list