Message9187

Author valtron
Recipients valtron
Date 2014-10-30.15:51:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1414684292.19.0.781558466768.issue2225@psf.upfronthosting.co.za>
In-reply-to
Content
Same problem as http://bugs.jython.org/issue1629, but has resurfaced from a different cause. In this case, I think it's due to this commit: https://hg.python.org/jython/rev/51b28cc2c43d.

What happens:
- ModjyJServlet.init: creates a new interpreter, and then calls setupEnvironment
- creating a new interpreter calls imp.load("site") because of Options.importSite
- this throws "ImportError: No module named site"
- from the fix to #1629, it looks like processPythonLib has to be called before the "site" package can be imported...but that method needs an interpreter, whose instantiation tries to load "site", so it's a kind of circular problem

Maybe I need to set the importSite option to false; but I'm not sure how to do this in a war file, especially since that option isn't read from the registry.

Here's the traceback I get (running the war file in tomcat):

ImportError: No module named site

	at org.python.core.Py.ImportError(Py.java:300)
	at org.python.core.imp.import_first(imp.java:760)
	at org.python.core.imp.load(imp.java:633)
	at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:126)
	at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:104)
	at com.xhaus.modjy.ModjyJServlet.init(ModjyJServlet.java:108)
	at javax.servlet.GenericServlet.init(GenericServlet.java:158)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5231)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5518)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
History
Date User Action Args
2014-10-30 15:51:32valtronsetrecipients: + valtron
2014-10-30 15:51:32valtronsetmessageid: <1414684292.19.0.781558466768.issue2225@psf.upfronthosting.co.za>
2014-10-30 15:51:32valtronlinkissue2225 messages
2014-10-30 15:51:31valtroncreate