Hello,
I am using a module that requires gevent but as a consequence my existing code that uses subprocess poll() method no longer works. I understand that it is set to False because of gevent.
In short I'm running a subprocess (external command) within a thread that uses process.poll() to check for the existence of that process. Unfortunately it spits out this but still works.
File "./app.py", line 67, in target
self.output, self.error = self.process.communicate()
File "/usr/lib/python2.7/subprocess.py", line 799, in communicate
return self._communicate(input)
File "/usr/lib/python2.7/subprocess.py", line 1401, in _communicate
stdout, stderr = self._communicate_with_poll(input)
File "/usr/lib/python2.7/subprocess.py", line 1431, in _communicate_with_poll
poller = select.poll()
AttributeError: 'module' object has no attribute 'poll'
I am unclear on monkey patching and what it does in general but if I add the code below:
from gevent import monkey; monkey.patch_all(subprocess=True)
I no longer see the aforementioned error but poll() no longer works. Is there a way to use both gevent and subprocess poll() within my code?
Or is there another method to poll for whether my subprocess is still running with my thread?
Thanks