logo       

module difflib not found: msg#00074

lang.jython.user

Subject: module difflib not found

This is a piece of Java code where I try to use a Python source code file.

try {
Properties preProperties = System.getProperties();
Properties postProperties = new Properties();
postProperties.put("sys.path", "/home/lddekeyz/python/Libs");

String[] input = { page1, page2 }; //defined above
PythonInterpreter.initialize(preProperties, postProperties, input);
PythonInterpreter interp = new PythonInterpreter();

interp.execfile(inputStream);//also defined above, is a inputStream to a source file
PyObject output = interp.get("output");
String finalResult = (String) output.__tojava__(String.class);

log.warn("the result is : " + finalResult);
} catch (Exception e) {
log.warn("=========> interpretion went wrong : " + e);
}

In this code file, the difflib module is imported. But when this Java code is run, I get following warning in my log:

WARNING: =========> interpretion went wrong : Traceback (innermost last):
File "<iostream>", line 9, in ?
ImportError: no module named difflib

Any idea what's wrong here? The difflib.py module is in the Lib directory.

If you don"t have a registry file, then it doesn"t
matter. The default sys.path is initialized from
the "python.path" property.


Lieven De Keyzer wrote:
> public static void initialize(java.util.Properties preProperties,
> java.util.Properties postProperties,
> java.lang.String[] argv)
> > is sys.path supposed to be in the preProperties or the postProperties?

> > >> From: Jeff Emanuel <jemanuel@xxxxx>
>> To: Lieven De Keyzer <lieven_dekeyzer@xxxxx>
>> CC: jython-users@xxxxx
>> Subject: Re: [Jython-users] jython.jar in classpath
>> Date: Sat, 28 May 2005 11:40:08 -0600
>>
>> Depending on what the python code calls, you probably need the
>> Lib directory installed and sys.path pointing to it.
>> Lieven De Keyzer wrote:
>>
>>> I"m making a webapplication in Java. I want to execute a piece of >>> Python code in a Java class. Is it ok if I just make sure the the >>> jython.jar file is in my classpath, or do I really need to have >>> jython installed to be able to execute python code?
>>>
>>>
>>>
>>>
>>> -------------------------------------------------------
>>> This SF.Net email is sponsored by Yahoo.
>>> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
>>> Search APIs Find out how you can build Yahoo! directly into your own
>>> Applications - visit >>> http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
>>> _______________________________________________
>>> Jython-users mailing list
>>> Jython-users@xxxxx
>>> https://lists.sourceforge.net/lists/listinfo/jython-users
>>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
> _______________________________________________
> Jython-users mailing list
> Jython-users@xxxxx
> https://lists.sourceforge.net/lists/listinfo/jython-users




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise