Hi,
Code mixing py4j and gevent that worked fine in Python 2 seems to be broken in Python 3.
I have used py4j to handle communication between a scientific instrument control application (Python, using gevent) and an external java process. A cut-down test is given below. The external process is too complex to cut down (sorry); its first action is to call the processMessage function on the Python side with a java object message parameter.
When using the make_gateway function (Python 2.7.13, OpenSUSE, Miniconda environment. Versions: gevent: 1.2.1, greenlet: 0.4.12, py4j: 0.10.4)
the test works and gets to the end of processMessage. The code relies on reloading socket, starting the py4j connection, and then repatching socket.
Without the reload, repatch steps (make_gateway2) in Python 2, or with either version in Python 3 (Python 3.6.13, gevent 1.3.7, greenlet 1.0.0, py4j 0.10.9.2)
the line
txt = str(py4j_message)
raises an error, apparently because gevent is asked to execute a command in a different thread. More detailed error messages attached
Does anyone have any suggestions?
Thanks in advance,
Rasmus Fogh
Global phasing Ltd., Cambridge