alonho/pystuck

Throw an exception if gevent is imported before pystuck

Opened this issue · 1 comments

monkey patching only works if pystuck is imported first and pystuck.greenlets.patch() is called

    pystuck.run_server()
  File "/usr/local/lib/python3.6/dist-packages/pystuck-0.8.5-py3.6.egg/pystuck/rpyc_tools.py", line 24, in run_server
  File "/home/lkcl/src/rpyc/rpyc/__init__.py", line 55, in <module>
    from rpyc.utils.server import OneShotServer, ThreadedServer, ThreadPoolServer, ForkingServer
  File "/home/lkcl/src/rpyc/rpyc/utils/server.py", line 22, in <module>
    gevent = safe_import("gevent")
  File "/home/lkcl/src/rpyc/rpyc/lib/__init__.py", line 25, in safe_import
    mod = __import__(name, None, None, "*")
  File "/usr/local/lib/python3.6/dist-packages/gevent/__init__.py", line 87, in <module>
    from gevent._hub_local import get_hub
  File "/usr/local/lib/python3.6/dist-packages/gevent/_hub_local.py", line 101, in <module>
    import_c_accel(globals(), 'gevent.__hub_local')
  File "/usr/local/lib/python3.6/dist-packages/gevent/_util.py", line 105, in import_c_accel
    mod = importlib.import_module(cname)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "src/gevent/__greenlet_primitives.pxd", line 37, in init gevent.__hub_local
  File "src/gevent/_greenlet_primitives.py", line 33, in init gevent.__greenlet_primitives
TypeError: type 'gevent.__greenlet_primitives.TrackedRawGreenlet' is not dynamically allocated but its base type 'PatchedGreenlet' is dynamically allocated

python3.6, import pystuck then run_server is not working at all

 pip3 install gevent greenlet bpython
Collecting gevent
  Using cached https://files.pythonhosted.org/packages/43/3d/a19fece28ba1b5133cf74bd22a229d77b4d9cc4b24aa8f263cca2845c555/gevent-1.3.6-cp36-cp36m-manylinux1_x86_64.whl
Collecting greenlet
  Using cached https://files.pythonhosted.org/packages/de/7b/cb662640540725deb0627264f6b890ee2b7725848b8cbca49e27bf3273c6/greenlet-0.4.14-cp36-cp36m-manylinux1_x86_64.whl