Pyside + Requests + Multiprocessing ... strange behavior
-
Hi,
I need some help about this script.
When I Execute it in IPython, the first call to do_cmd() is ok.
But when I call do_cmd() from the QPushButton event() the function hangs ....Can you try this on your setup please ? Just to see if it is related to my config/setup ?
Thanks !
@import multiprocessing
import requestsdef run_and_wait():
for i in range(10):
print 'Turn #%i' % i
requests.get('http://google.com')
print 'Turn #%i done' % i
print 'End'def do_cmd():
process = multiprocessing.Process(target=run_and_wait)
process.start()
process.join()#from here it works
do_cmd()from PySide.QtGui import QApplication, QPushButton
app = QApplication([])
button = QPushButton('Do')
#from here it does not work
button.clicked.connect(do_cmd)
button.show()
app.exec_()@(To install requests : pip install requests)