How would a Python script running on Linux call a routine in a Python script running under Wine? -


i have python (3) script running on linux, referred main script, has call routine proprietary dll. far, have solved wine using following construct:

# main script running on linux import subprocess # [...] subprocess.popen('echo "python dll_call.py %s" | wine cmd &' % options, shell = true) # [...] 

the script dll_call.py executed windows python (3) interpreter installed under wine. dumps return values file picked waiting main script. it's not reliable , agonizingly slow if have few times in row.

i'd start script dll_call.py once, offering type of simple server, should expose required routine in sort of way. @ end of day, i'd have main script looking this:

# main script running on linux import subprocess # [...] subprocess.popen('echo "python dll_call_server.py" | wine cmd &', shell = true) # [...] return_values = call_into_dll(options) 

how can implemented best (if speed required , security not concern)?

you can use xmlrpc client , servers built-in python's stdlib want. make wine-python expose desired functions xmlrpc methods, , make inter-process call other python program that.

it works calling functions running in jython or ironpython cpython, , across python2 , python3 - examples included in module documentation should enough.just check docs: https://docs.python.org/2/library/xmlrpclib.html

if need calls asynchronous on client side, or server site respond more 1 process, can find other frameworks on build calls - celery should work across several different pythons while preserving call compatibility, , enough performance-wise.


Comments