Here is how I finally got this working.

1. In the generate tag, create a parameter to hold the python.path (not
PYTHONPATH, thats for CPython)

   <map:match pattern="jython/*">
    <map:generate type="script" src="jython/{1}" >
      <map:parameter name="python.path" value="c:/java/jython-2.1/Lib"
/>
    </map:generate>
    <map:transform src="stylesheets/test/simple-page2html.xsl"/>
    <map:serialize type="html"/>
   </map:match>

2. In the actual python script, before trying to import any modules

params   = bsf.lookupBean( "parameters" )
# params is a org.apache.avalon.framework.parameters.Parameters
props = System.getProperties()
import sys  # thats the Jython standard library, includes sys.path
pth = params.getParameter("python.path")
sys.path.insert(0, pth )
# now it should search there first for modules
===

[EMAIL PROTECTED]
Author of Soap Programming with Java - Sybex; ISBN: 0782129285




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to