From: Moore, G. <Gre...@ad...> - 2007-09-25 19:02:39
|
Dave,=20 I don't think I have much of an answer for you really just a vague recollection. I recall someone much more knowledgeable the I saying something about the way sys.path was interpreted by the JVM. If you use sys.path one way it set a specific way and if it was used another way it was set differently. I confess that I may have it wrong or out of context.=20 Sorry I know that's not much help. I guess I'm as confused as you are :) Greg. -----Original Message----- Sent: Tuesday, September 25, 2007 11:38 AM To: jyt...@li... Subject: [Jython-dev] Deploying app in jar file I have some questions about the use of jar files with jython. I'm using jython 2.2.1rc1. Suppose I copy jython.jar: $ cp ../jython2.2.1rc1/jython.jar application.jar Suppose testfuture.py contains: # testfuture.py #from __future__ import generators import sys print 'sys.version:', sys.version print 'sys.path:', sys.path Then I run: $ java -jar application.jar testfuture.py *sys-package-mgr*: can't create package cache dir, '/home/dkuhlman/a1/ Python/Jython/Test/application.jar/cachedir/packages' sys.version: 2.2.1rc1 sys.path: ['', '/home/dkuhlman/a1/Python/Jython/Test/application.jar/Lib', '__classpath__'] Good. Now I uncomment the import from __future__, then run it again and I see: $ java -jar application.jar testfuture.py *sys-package-mgr*: can't create package cache dir, '/home/dkuhlman/a1/ Python/Jython/Test/application.jar/cachedir/packages' Traceback (innermost last): File "testfuture.py", line 2, in ? ImportError: no module named __future__ And, if I rename testfuture.py to __run__.py and add it at the root of=20 application.jar, then run jython instead of java, I see the following: ~/a1/Python/Jython/Test [145] jython -jar application.jar sys.version: 2.2.1rc1 sys.path: ['', '/home/dkuhlman/a1/Python/Jython/jython2.2.1rc1/Lib', '__classpath__'] The __future__ error has gone away. But, sys.path is now wrong. It should=20 contain '/home/dkuhlman/a1/Python/Jython/Test/application.jar/Lib' as before,=20 shouldn't it? It seems to me that there is a bug there. But, I'm unsure, because I do not=20 know what java/jython is supposed to do or is trying to do. I've come across the above in trying to use Greg Moore's article on=20 distributing Jython applications at:=20 http://wiki.python.org/jython/JythonFaq/DistributingJythonScripts Am I trying to do something that I should not be doing? If so, how do I deploy=20 an application in a jar file? Dave ------------------------------------------------------------------------ - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Jython-dev mailing list Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-dev This message and any attachments are intended only for the use of the add= ressee and may contain information that is privileged and confidential. I= f the reader of the message is not the intended recipient or an authorize= d representative of the intended recipient, you are hereby notified that = any dissemination of this communication is strictly prohibited. If you ha= ve received this communication in error, please notify us immediately by = e-mail and delete the message and any attachments from your system. |