Issue #11 on hold

execnet submodules not found when packed in a jar for use with Jython (patch included)

created an issue


A little bit of context: I am working on an image processing software ( 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 I have filed an issue and submitted a patch for here:

(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 !

Comments (8)

  1. Ronny Pfannschmidt

    at first glance the patch is slightly incorrect and wont work on python3 also i think there is need to call the function differently,

    i'll implement a modified version of your approach + tests in apipkg

  2. tlecomte reporter

    I know realize that, when packaged this way in a jar (with my patch...), execnet seems to be unable to bootstrap itself. It only works when the remote has it already installed. Do you think this can be fixed too ?

  3. tlecomte reporter

    Regarding my last comment: execnet cannot bootstrap itself when packaged in a jar because the inspect module does not work well in that case. Anyway, we solved this issue in our case by properly extracting the Python files from the jar to the disk.

    I am closing this issue since the initial problem is solved !

  4. Log in to comment