'module' object has no attribute 'poll'

2,500 views
Skip to first unread message

dsfdf

unread,
Jan 19, 2013, 12:40:52 AM1/19/13
to gev...@googlegroups.com
My old vm uses 10.04 ubuntu so the default was 2.6.5, but we were using 0.13.7 which was relatively new. The latest is 0.13.8 if i am corrected.

We have been using

monkey.patch_all() the whole time. We now migrated to 2.7.3 on ubuntu 12.04
But when we use that, we get the error in the title. Basically, select cannot be patched out.

  File "/home/vagrant/aurum/aurum/views.py", line 624, in put_latest_solution
    password=password, teardown=False)
  File "<string>", line 2, in clone
  File "/home/vagrant/vens/aurum/src/repoman/src/repoman/lib.py", line 63, in _supported
    return f(*args, **kwargs)
  File "/home/vagrant/vens/aurum/src/repoman/src/repoman/core.py", line 93, in clone
    stdout, stderr = cmd(['hg', 'init', local])
  File "/home/vagrant/vens/aurum/src/repoman/src/repoman/lib.py", line 45, in cmd
    stdout, stderr = pid.communicate()
  File "/usr/lib/python2.7/subprocess.py", line 754, in communicate
    return self._communicate(input)
  File "/usr/lib/python2.7/subprocess.py", line 1312, in _communicate
    stdout, stderr = self._communicate_with_poll(input)
  File "/usr/lib/python2.7/subprocess.py", line 1342, in _communicate_with_poll
    poller = select.poll()
AttributeError: 'module' object has no attribute 'poll'

The same library `repoman` is used in other projects so it can't be the library itself. 
We pip install from requirements which are up-to-date with our previous vm, so the state should be the same.
Any idea why we are required to make `select=False`?

If we do make `select=False`, does it turn off any specific advantage of gevent? We are just using gevent.Greenlet right now. I assume when `thread=false`, we will not get the benefit of green thread, right?

Thanks.

Denis Bilenko

unread,
Jan 19, 2013, 2:37:49 AM1/19/13
to gev...@googlegroups.com
On Sat, Jan 19, 2013 at 6:40 AM, dsfdf <gokop...@gmail.com> wrote:
> My old vm uses 10.04 ubuntu so the default was 2.6.5, but we were using
> 0.13.7 which was relatively new. The latest is 0.13.8 if i am corrected.
>
> We have been using
>
> monkey.patch_all() the whole time. We now migrated to 2.7.3 on ubuntu 12.04
> But when we use that, we get the error in the title. Basically, select
> cannot be patched out.

gevent does not implement emulation of poll(), so monkey.patch_all()
removes it from select module.

You can disable this behavior by passing aggressive=False to
patch_all() or patch_select(). See monkey.py for details.

However, most libraries, subprocess.py included, check if poll is
present and switch to select() if it's not (search for has_poll in
subprocess.py).

The fact that it does not in your case most likely means that you
import subprocess after you monkey patch stdlib. Try to monkey patch
early and it should work.

Cheers,
Denis.
Reply all
Reply to author
Forward
0 new messages