[Py4j-users] Calling Python from Java side?
Status: Beta
Brought to you by:
barthe
|
From: Frank J. I. Jr. <fr...@ae...> - 2015-02-17 04:38:37
|
Hi, Barthelemy, thanks for contributing Py4J! Is Py4J suitable for enabling me to call Python methods (e.g. SciPy library) from my Java program? I've succeeded in exercising the Getting Started example: http://py4j.sourceforge.net/getting_started.html I am trying to grok your example: http://py4j.sourceforge.net/advanced_topics.html#implementing-java-interfaces-from-python-callback which was pointed to in response to a similar StackOverflow question: http://stackoverflow.com/questions/23157424/py4j-how-would-i-go-about-on-calling-a-python-method-in-java?rq=1 Although I can see (from the OperatorExample.java file in the distribution) that Java File2 is not showing this method: public static void main(String[] args) { GatewayServer server = new GatewayServer(new OperatorExample()); server.start(); } , I still can't see from this example how to call Python functions from my Java program. Where this example (final lines in Python code) show: # "Sends" python object to the Java side. numbers = operator_example.randomBinaryOperator(operator) the meaning of "Sends" seems to imply a "non-stop round-trip" starting from and ending on the Python side. Is Py4J the wrong tool to be using for what I'm seeking? Any advice appreciated! Thanks, Frank -- Frank J. Iannarilli fr...@ae... Aerodyne Research, Inc., 45 Manning Road, Billerica, MA 01821 USA |