Right way to call Python code from Java

asked 2019-03-15 15:08:22 +0800

Vindieselwalker gravatar image Vindieselwalker

In my company some data science components are written using Python scripts. But our web application is Java. Now, I need to call these Python scripts from my web application supplying some data and run time parameters. What is the best way to make such calls.

Our data scientists are thinking of opening their Python APIs as ZeroRPC based endpoints and expect me to write a Java client to call their APIs. (I Googled and there is not a lot of information on this). Is this the right way? What are the typical/standard ways to interact with Python code?

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-04-11 12:52:10 +0800

cor3000 gravatar image cor3000
4531 2 7
ZK Team

updated 2019-04-11 12:52:29 +0800

unusual question ... (for a ZK forum) I guess the simplest way would be to execute a new process and consume the output stream


as for remote calls (RPC) it depends on the protocol used, if you find a Java api to call zerorpc

I found this 5 year old implementation: https://github.com/jamescarr/zerorpc-java

the code for the client implementation doesn't look complicated and easy to reuse:


I haven't tried this but it looks like it's based on 2 other libraries jeromq and msgpack (which still seem active up to today)

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2019-03-15 15:08:22 +0800

Seen: 7 times

Last updated: Apr 11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More