From: <bc...@wo...> - 2001-01-22 20:41:55
|
[Robert W. Bill] >Freezing servlet applications have resulted in difficulty with >the javaos module. The simple scenario is I need to use >os.stat(file), but all frozen applications return the error: > > AttributeError: class 'org.python.modules.os' has no attribute 'stat' > >When using jythonc, i've tried: > > jythonc -a -j app.jar jyDispatch.py > jythonc -a -j app.jar jyDispatch.py javaos os re string others... > jythonc -c -j app.jar jyDispatch.py javaos etc.... > jythonc -a -A c:\jython-2.0\lib\javaos -j app.jar jyDispatch.py os > >All result in the above AttributeError. > >I've assumed stat requires os + javaos- does it? Yes. >How do I freeze an application so that I can use it? When I just tried to freeze this little module I got an NPE: import os print os.stat This is an unintended sideeffect on a hack I added to satisfy site.py's use of the os module. It occur when sys.prefix is None which typically happens for frozen applications. Changing the module to: import sys sys.prefix = "." import os print os.stat and it runs as expected. I compiled the module with the simple: jythonc.bat -j app.jar -a app.py I'm not 100% sure this is the situation you are seeing, but please give it a try. regards, finn |