473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Jython Problem

Hello,

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:
http://jython.sourceforge.net/cgi-bi...=faq06.002.htp

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 2971
dvs
12
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

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

Similar topics

1
by: Clay Shirky | last post by:
Can Jython be used to write applications to run in J2ME environments? I ask because Python seems an ideal language for teaching students to write applications for the phone or other mobile devices....
10
by: Randall Smith | last post by:
I would like to use a type 4 JDBC driver in my Python program. I believe I can use in with Jython. Do you know of some way to communicate between the Jython and Python processes so that the...
4
by: angel | last post by:
A java runtime environment includes jvm and java class (for example classes.zip in sun jre). Of course jython need jvm,but does it need java class. Thanx
7
by: Jan Gregor | last post by:
Hello I found that jython catches exact java exceptions, not their subclasses. Is there some way to get around this limitation (or error) ? My program has class representing database source...
5
by: Maurice Ling | last post by:
Hi, I have read that this had been asked before but there's no satisfactory replies then. I have a module (pA) written in python, which originally is called by another python module (pB), and...
1
by: Nandan | last post by:
hello, can I ask a jython question here? when I use the jython interpreter I have no problem with the statement: from java import lang from javax import swing but when I put this in a...
1
by: scott | last post by:
I installed darwinports and did a "sudo port install jython" ------------------------- scott$ which jython /opt/local/bin/jython ------------------------- Jython works in interactive...
1
by: Mark Fink | last post by:
Hi there, unfortunately I am new to Jython and my "Jython Essentials" book is still in the mail. I looked into the Jython API Doc but could not find the information. I am porting a Python...
2
by: didier.prophete | last post by:
Ok, so I know this is probably a common jython error, but somehow I can't seem to find an answer to this trivial problem. Ok, I have the following (simple) directory structure: $TOP/...
4
by: Neil Wallace | last post by:
Hi all, I am a novice Python/Jython programmer, and Ubuntu user. Ubuntu still only supports only version 2.1 of Jython. I have used the GUI installer of Jython 2.2, and installed it to the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.