jython __init__.py and jar files

Todd Moyer tmoyer at inventa.com
Thu Jun 24 19:22:33 EDT 2004


I was trying to run an example from the Jython Essentials book but kept getting
an error saying:

java package 'org.jdom.input' has no attribute 'SAXBuilder'

Apparently, it couldn't find the SAXBuilder class, even though I 
had set the sys.path to the jar and it seemed to be finding the jar.

Eventually I extracted the files from the jar, but it still wasn't finding
the SAXBuilder class.  Then I added __init__.py files to the 'org', 'jdom' and 
'input' dirs and wallah!, everything works.

This leads me to a rather odd conclusion:

A real Java jar isn't going to work for Jython because it won't have __init__
files.

Has anyone else run into this?  Is my conclusion correct or am I missing
something?



More information about the Python-list mailing list