execnet submodules not found when packed in a jar for use with Jython (patch included)
A little bit of context: I am working on an image processing software (icy.bioimageanalysis.org) written in Java. We've recently added a Jython scripting engine, and I have been trying to distribute execnet along with Jython so that users can easily write scripts that communicate with CPython and use Numpy, for example.
The problem I encounter is that I want to distribute the execnet inside a jar file. Normally it's just a matter of putting the python files in the jar, but for execnet the module cannot be used from the resulting jar. As soon as an execnet command is called, it fails with: "ImportError: No module name *" where * is the name of one of the sub-module of execnet ("multi" for example).
It turns out that the problem lies in apipkg.py. I have filed an issue and submitted a patch for apipkg.py here: https://bitbucket.org/hpk42/apipkg/issue/3/modules-not-founds-when-packed-in-a-jar
(The problem comes from the assumption that python modules are plain files with a true path. Instead, when run by Jython from a jar, the module is located in a virtual place called "pyclasspath". I have modified the use of os.path.abspath to avoid modifying paths that begins with pyclasspath and now execnet works properly. A patch is attached to the issue).
Do you think this could be included for a new release of execnet ? Thanks !