[Jython] ImportError: no module named XML

Robert Oschler Oschler at earthlink.net
Thu Nov 7 22:30:26 EST 2002


In a python script I have I have the following line:

from xml.dom import minidom

Now if run the script in the external Jython shell, that is, I switch to my
Jython install directory (c:\jython-2.1) and at a command line type "> run",
the script runs fine.  There are no complaints at all.

However, when I run the script in a PythonInterpreter instance in my Java
Bean/applet, I get a error saying "ImportError: no module named xml".  In my
jar I added everything in the entire Jython.jar file except the manifest.  I
added the entire "com", "org", and "jxxload_help" packages.  I checked the
JAR contents with "jar tf" and they are all there.

Just to be exact, when I say "run the script" I mean I instantiate a new
PythonInterpreter instance.  I select a file from an AWT FileDialog()
session and read the selected file into a String restoring the linefeeds
removed by readline() as I go.  I then ".exec" the string.

Any ideas?

thx






More information about the Python-list mailing list