1. Holger Krekel
  2. apipkg
  3. Issues


Issue #3 resolved

modules not founds 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 (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, because it assumes the python modules are plain python file with a true path. Instead, when run by Jython from the 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. Please find the patch attached.

Do you think this could be included for a new release of apipkg ? Thanks !