Work between multiple processes
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. -- https://mail.python.org/mailman/listinfo/python-list
Work between multiple processes
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. -- https://mail.python.org/mailman/listinfo/python-list
Re: Re: Calling C++ Modules in Python
Dan, Recently I am trying out both the SWIG and BOOST, maybe Cython later. However, I didn't get lucky with the combination of the latest SWIGwin 2.0.2 and Python3.2. No matter I build _example.pyd, example.pyd or _example.dll, or example.dll, it just doesn't get imported as said in the instruction. Is the combination similar to what you are using right now? Cheers -Patrick On Fri, Mar 11, 2011 at 5:37 PM, Dan Stromberg drsali...@gmail.com wrote: I've not tried Boost, but I don't think SWIG or Cython require modified libraries. You just compile your wrapper, and then import it. On Fri, Mar 11, 2011 at 2:16 PM, zxpat...@gmail.com wrote: Dan, Thanks for the info. Really I was hoping for a non-intrusive way to expose existing C++ libraries to python. However, both solutions (BOOST, SWIG) listed here require the recompilation of libraries?! Seems Cython is doing the similar way? It is ok for small applications but will be hard for big software from big companies. The reason is that even companies are willing to rebuild their own libraries with those wrappers or decorations added(though needs approves from all sorts of departments :)), they can't force their 3rd-party developers/users. Correct me if I am wrong. Rg, -Patrick On Mar 11, 2011 4:59pm, Dan Stromberg drsali...@gmail.com wrote: On Fri, Mar 11, 2011 at 1:15 PM, Patrick zxpat...@gmail.com wrote: Hi, I saw in the Beginner document that •Is easily extended by adding new modules implemented in a compiled language such as C or C++. . While to my investigation, it seems not that easy or did I miss something? boost python (C++ libraries need to be re-compiled with written wrappers again?). SWIG (It works by taking the declarations found in C/C++ header and using them to generate the wrapper code that scripting languages need to access the underlying C/C++ code). I guess it should be asked: easy for who? easy is always relative to some context. If you're planning to stay with CPython and C++ forevermore, then Cython is a nice way of gluing the two. Cython looks like Python code, but it gives you access to C and C++ code and data as well as CPython code and data. If you're planning to support your C++ code with more languages than CPython, you might be better off with SWIG. If you really do want to do the task the old way, you're probably best off copying some preexisting module with a maximize-the-developers-rights license (like Apache, MIT or 3 clause BSD), and modifying that. If you want to be able to move easily to pypy, I might suggest coming up with a C wrapper for your C++ code, and then accessing the C code using ctypes. That should work in CPython and pypy, and it looks like jython might support this soon as well. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: Calling C++ Modules in Python
Dan, Thanks for the info. Really I was hoping for a non-intrusive way to expose existing C++ libraries to python. However, both solutions (BOOST, SWIG) listed here require the recompilation of libraries?! Seems Cython is doing the similar way? It is ok for small applications but will be hard for big software from big companies. The reason is that even companies are willing to rebuild their own libraries with those wrappers or decorations added(though needs approves from all sorts of departments :)), they can't force their 3rd-party developers/users. Correct me if I am wrong. Rg, -Patrick On Mar 11, 2011 4:59pm, Dan Stromberg drsali...@gmail.com wrote: On Fri, Mar 11, 2011 at 1:15 PM, Patrick zxpat...@gmail.com wrote: Hi, I saw in the Beginner document that •Is easily extended by adding new modules implemented in a compiled language such as C or C++. . While to my investigation, it seems not that easy or did I miss something? boost python (C++ libraries need to be re-compiled with written wrappers again?). SWIG (It works by taking the declarations found in C/C++ header and using them to generate the wrapper code that scripting languages need to access the underlying C/C++ code). I guess it should be asked: easy for who? easy is always relative to some context. If you're planning to stay with CPython and C++ forevermore, then Cython is a nice way of gluing the two. Cython looks like Python code, but it gives you access to C and C++ code and data as well as CPython code and data. If you're planning to support your C++ code with more languages than CPython, you might be better off with SWIG. If you really do want to do the task the old way, you're probably best off copying some preexisting module with a maximize-the-developers-rights license (like Apache, MIT or 3 clause BSD), and modifying that. If you want to be able to move easily to pypy, I might suggest coming up with a C wrapper for your C++ code, and then accessing the C code using ctypes. That should work in CPython and pypy, and it looks like jython might support this soon as well. -- http://mail.python.org/mailman/listinfo/python-list