pyqt4 - Python URLLib does not work with PyQt + Multiprocessing -
a simple code such:
import urllib2 import requests pyqt4 import qtcore import multiprocessing import time data = ( ['a', '2'], ) def mp_worker((inputs, the_time)): r = requests.get('http://www.gpsbasecamp.com/national-parks') request = urllib2.request("http://www.gpsbasecamp.com/national-parks") response = urllib2.urlopen(request) def mp_handler(): p = multiprocessing.pool(2) p.map(mp_worker, data) if __name__ == '__main__': mp_handler()
basically, if import pyqt4, , have urllib request (i believe used in web extraction libraries such beautifulsoup, requests or pyquery. crashes cryptic log on mac)
this true. fails on mac, have wasted rows of days fix this. , there no fix of now. best way use thread instead of process , work charm.
by way -
r = requests.get('http://www.gpsbasecamp.com/national-parks')
and
request = urllib2.request("http://www.gpsbasecamp.com/national-parks") response = urllib2.urlopen(request)
do 1 , same thing. why doing twice?
Comments
Post a Comment