472,127 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

Jython Problem


I'm trying to execute a Python script from a Java class using Jython. I'm running into the following error:

Exception in thread "main" Traceback (innermost last):
File "<string>", line 1, in ?
File "C:\PorkyPortal\diagram-generator\.\tilemaker.py", line 13, in ?
ImportError: no module named PIL

I've tried to solve the problem with these instructions:

Here is the code I'm using:

PythonInterpreter interp = new PythonInterpreter();

Properties props = new Properties();
props.setProperty("python.path", "C:\\Python24\\Lib; C:\\Python24\\Lib\\site-packages\\PIL; C:\\Python24\\Scripts\\");
PythonInterpreter.initialize(System.getProperties( ), props, new String[] {""});

interp.exec("import tilemaker");
interp.exec("import Image");
interp.exec("import glob");
interp.exec("img = tilemaker.prepare(AlternateExample.png, FFFFFF, chatty = False);");
interp.exec("img2 = tilemaker.subdivide(img, level = 0, quadrant=(0, 0), size=(128, 128),filename=outputName + '-%d-%d-%d.jpg', quality = None, chatty = False)");

Any suggestions?
Jul 12 '06 #1
1 2908
I think it's a bad idea to use Java -> Jython -> CPython.
Use Java native image manipulation libraries, or pure Python (aka CPython) + PIL.
Jul 20 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Clay Shirky | last post: by
10 posts views Thread by Randall Smith | last post: by
4 posts views Thread by angel | last post: by
7 posts views Thread by Jan Gregor | last post: by
1 post views Thread by Nandan | last post: by
1 post views Thread by Mark Fink | last post: by
2 posts views Thread by didier.prophete | last post: by
4 posts views Thread by Neil Wallace | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.