On Thursday, January 5, 2017 at 5:49:46 PM UTC-5, Irmen de Jong wrote: > On 4-1-2017 23:14, zxpat...@gmail.com wrote: > > Hi everyone, > > > > I ran into a case that I need to create a work process of an application > > (Jython so has to call using java.exe) which will collect the data based on > > what main process indicates. > > > > (1) I tried multiprocessing package, no luck. Java.exe can't be called from > > Process class? > > > > (2) I tried subprocess. subprocess.communicate function will wait for the > > work process to terminate so to return. > > > > > > either (1) or (2) doesn't work out well. Please suggest. Global system > > queue? > > > > Thanks, > > Patrick. > > > > > Is it a requirement that the workdf process is also Jython? > > If not: you could spawn a Python subprocess that hosts a Pyro4 daemon. > Utilizing the Pyrolite java client library you can call methods in it from the > java/jython side. (Unfortunately it is not yet possible (due to jython > incompatibilities) to use the full Pyro4 library on the Jython side as well). > Not sure if it meets your set of requirements but have a look at > http://pythonhosted.org/Pyro4/ > http://pythonhosted.org/Pyro4/pyrolite.html > > > Irmen
Thanks Irmen. I think that could be the solution I am looking for. The main process will be native python so it can be used to host a pyro daemon even with lock. The jython will be a subprocess that takes the daemon's uri and use the pyrolite library to make the communication. The only trouble is that I will have to involve two more java libraries but I don't think it is a big of deal. Will try it and post the source code if possible. -- https://mail.python.org/mailman/listinfo/python-list