3

When i try to do mutliprocessing in python Qgis it doesn't work

from multiprocessing import Process,Lock
import multiprocessing

def name1(l,i):
    print i

if __name__=='__main__':
    lock=Lock()
    for i in range(5):
        print (i,'process start')
        process=multiprocessing.Process(target=name1,args=(lock,i,))
        process.start()


The above code it's working perfectly in eclipse and other IDE's but it is not working with qgis python script
output from eclipse:
(0, 'process start')
(1, 'process start')
(2, 'process start')
(3, 'process start')
(4, 'process start')
1
2
3
4
0

But in pyqgis there's no error and no output

  • It works in the Python console of QGIS – gene Aug 27 '15 at 17:33
  • Expand on "doesn't work". Error messages, unexpected behavior, etc. – Evil Genius Aug 27 '15 at 17:56
  • I was running the code it doesn't give me any output – Raja Gopal Aug 27 '15 at 18:03
  • How do you run your code? Which version of QGIS? In the QGIS console, __name__ is console, so your if-condition will be false and your code will not get executed. If you remove your condition, you might be successful. – chkaiser Aug 27 '15 at 18:57
  • 1
    Please edit the question in response to comments requesting clarification. It is unfair for those who would help you to need to scan comments for critical details. – Vince Aug 29 '15 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.