From: Ihab A.B. A. <ih...@ah...> - 2001-10-22 18:39:51
|
Hi all, More re this issue. I finally decided to use PyServlet verbatim, as a baseline test case. Here is the relevant part of my "web.xml" file -- <servlet> <servlet-name>PyServlet</servlet-name> <servlet-class>org.python.util.PyServlet</servlet-class> <init-param> <param-name>python.home</param-name> <param-value>/opt/java/jython-2.1a1</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>PyServlet</servlet-name> <url-pattern>*.py</url-pattern> </servlet-mapping> and here is a servlet in Jython -- from javax.servlet.http import HttpServlet import os class test(HttpServlet): def doGet(self, req, res): res.setContentType("text/html"); out = res.getOutputStream() print >>out, "Hello World, how are we?" print >>out, dir(os) print >>out, os.listdir('/home/ihab') out.close() return Now, when I invoke this, I get the following -- Hello World, how are we? ['__depends__', 'classDictInit'] A Servlet Exception Has Occurred Traceback (innermost last): File "/home/ihab/www-docs/logs/../bin/../webapps/omtdb/ ... edu/umn/genomics/omtdb/test.py", line 24, in doGet AttributeError: class 'org.python.modules.os' has no attribute 'listdir' so notice that dir(os) does not show any of the symbols that I would expect to find and, of course, invoking os.listdir() raises an exception. Thanks & peace, Ihab -- Ihab A.B. Awad <ih...@ah...> Center for Computational Genomics and Bioinformatics, University of Minnesota. http://www.cbc.umn.edu/~ihab/ |