Actually, AppEngine will let you do it, with some finagling.

Find your Jython "Lib" folder, and put the folder's contents into a zipfile (I called it "Lib.zip", original, maybe not, but effective).

Then find a place for it in your webapp's folder (I use war/WEB-INF/lib-python/Lib.zip for mine).

I then add the following lines at the beginning of my python script:

import sys
sys.path.insert(0, 'WEB-INF/lib-python/Lib.zip')

Then I can import the python library modules as normal.

I've used this both in a stand-aline jython web-app and an embedded (JSR-233) manner. The latter lets me attach those lines to the beginning of the script's string before I process the script for execution, which cleaned up my python scripts by removing otherwise extraneous lines of code from the scripts. For the former, I simply put those two lines into a .py script themselves and imported that instead.

On Mon, Mar 15, 2010 at 12:49 PM, Tom Nichols <tmnichols@gmail.com> wrote:
So in working on my python web console, I've only just realized that
all of the standard CPython modules that Jython supports actually
exist as .py files that are loaded at runtime.  This presents a
potentially serious problem for me:  AppEngine doesn't allow direct
file access at runtime!  I suspect the internals of Jython's import
mechanism is looking for a .py file on the system path, which won't
work at all in the Java AppEngine runtime.  Now, if there's a way for
those imports to be read from the classpath instead of the filesystem,
then I'll be all set.  If not, the project is somewhat hosed, as the
inability to use virutally _any_ of the standard cpython libraries
presents a considerable limitation to the project.

Can Jython modules be loaded from the classpath??

Any suggestions from the wise Jython project maintainers?

Thanks.
-Tom

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users



--
"I'm not responcabel fer my computer's spleling errnors" - Xlorep DarkHelm
Website: http://darkhelm.org