Skip to content

AttributeError: 'module' object has no attribute 'core' #4

@bra-fsn

Description

@bra-fsn

Hi,

With gevent dev (github master) and pistil, the following example code doesn't start:

import mimetypes
import os


from gevent import monkey
monkey.noisy = False
monkey.patch_all()

from pistil import util
from pistil.tcp.arbiter import TcpArbiter
from pistil.tcp.gevent_worker import TcpGeventWorker

class HttpWorker(TcpGeventWorker):

    def handle(self, sock, addr):
        sock.sendall("hallo\n")


def main():
    conf = {"address": ("127.0.0.1", 5000), "debug": True,
            "num_workers": 3}
    spec = (HttpWorker, 30, "send_file", {}, "worker",)

    arbiter = TcpArbiter(conf, spec)
    arbiter.run()


if __name__ == '__main__':
    main()

It gives the following error:
Traceback (most recent call last):
File "zzz.py", line 11, in
from pistil.tcp.gevent_worker import TcpGeventWorker
File "/usr/local/lib/python2.7/site-packages/pistil-0.2.0-py2.7.egg/pistil/tcp/gevent_worker.py", line 42, in
class TcpGeventWorker(TcpSyncWorker):
File "/usr/local/lib/python2.7/site-packages/pistil-0.2.0-py2.7.egg/pistil/tcp/gevent_worker.py", line 77, in TcpGeventWorker
if hasattr(gevent.core, 'dns_shutdown'):
AttributeError: 'module' object has no attribute 'core'

Adding
import gevent.core
to pistil/tcp/gevent_worker.py fixes this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions