You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I use to be able to use wit with multiprocessing but recently when I started using wit again, this fails now. I made a simple example that shows the failure. I created 2 classes, one with multiprocessing and one without. The multiprocessing class hangs up on wit.query_text() for some reason. If you comment it out and replace it with something like print 'hello!' it works fine. What happened to wit to break this?
#!/usr/bin/env python# -*- coding: utf-8 -*-importwitimportmultiprocessingasmpimporttimetoken='my token'# a class with multiprocessingclassMP(mp.Process):
def__init__(self):
mp.Process.__init__(self)
wit.init()
defrun(self):
whileTrue:
ans=wit.text_query('hello',token)
printanstime.sleep(2)
# just a normal classclassnonMP(object):
def__init__(self):
wit.init()
defrun(self):
whileTrue:
ans=wit.text_query('hello',token)
printanstime.sleep(2)
defstart(self):
self.run()
defjoin(self):
a=1# w = nonMP() # no multiprocessingw=MP() # with multiprocessingw.start()
w.join()
Platform: OSX 10.11.1
Python: 2.7.11
The text was updated successfully, but these errors were encountered:
Thanks @walchko!
We moved to a pure Python version of the library, which should have fixed this issue. The code below works for me (pywit 2.0). Feel free to reopen.
#!/usr/bin/env python# -*- coding: utf-8 -*-importwitimportmultiprocessingasmpimporttimetoken='token'# a class with multiprocessingclassMP(mp.Process):
def__init__(self):
mp.Process.__init__(self)
defrun(self):
whileTrue:
ans=wit.message(token, 'drive to twitter')
printanstime.sleep(2)
# just a normal classclassnonMP(object):
def__init__(self):
passdefrun(self):
whileTrue:
ans=wit.text_query('hello',token)
printanstime.sleep(2)
defstart(self):
self.run()
defjoin(self):
a=1# w = nonMP() # no multiprocessingw=MP() # with multiprocessingw.start()
w2=MP()
w2.start()
w.join()
w2.join()
Hello, I use to be able to use wit with multiprocessing but recently when I started using wit again, this fails now. I made a simple example that shows the failure. I created 2 classes, one with multiprocessing and one without. The multiprocessing class hangs up on
wit.query_text()
for some reason. If you comment it out and replace it with something likeprint 'hello!'
it works fine. What happened towit
to break this?Platform: OSX 10.11.1
Python: 2.7.11
The text was updated successfully, but these errors were encountered: