From: Harlan H. <ha...@ot...> - 2001-05-19 01:14:39
|
On May 18 at 12:03pm, jyt...@li... wrote: > Message: 5 > Date: Fri, 18 May 2001 10:44:58 -0400 > From: D-Man <ds...@ri...> > To: jyt...@li... > Subject: Re: [Jython-users] access to .py's in jars > > On Thu, May 17, 2001 at 07:26:36PM -0700, Harlan Hile wrote: > ... > | what i want to do now is bundle it all into a jar file... so, include all > | my com/otelnet/.class files, and then include a mymod.py at the root, or a > | mymod$py.class at the root, so when I have the jar in the classpath, i can > | import mymod > ... > | is there a way to do this? > > Use 'jythonc --jar' to build the jar file. Putting .py files into a > jar doesn't help at all. You need to have java bytecodes (.class) > files in the jar. You also need all the jython internals stuff that > your python code depends on in the jar as well (or any jar as long as > it is in the CLASSPATH). > > See jythonc --help for more information and more options. i discovered i dont need all the @sig stuff to have jythonc work... i thought i did because i was using jpythonc 1.1, which didnt work. with 2.0, I can create a java file, put it into my jar, and import it. unfortunately, importing it doesnt do much. >>> import session #this comes from session.class >>> dir(session) ['main', 'moduleDictInit'] what i would like to see is the same thing that comes from a .py file >>> import session #this comes from session.py >>> dir(session) ['ALTERNATE', 'BIGDECIMAL', 'BINARY', 'BOOLEAN', 'DATE', 'NO_WAIT', 'OTCCHAR', 'OTCDOUBLE', 'OTCLONG', 'OTCLONGLONG', 'OTCSHORT', 'PARAMETERLIST', 'PRIMARY', 'PyArray', 'PyLong', 'PyString', 'RC_OK', 'STRING', 'UNDEFINED', 'WAIT_INFINITE', '__file__', '__name__', 'com', 'createSession', 'createSessionGroup', 'invokemessage', 'java', 'parameterlist', 'pythonresponselistener', 'resultCodeToString', 'session', 'sessiongroup', 'statusToString', 'types'] it looks like the generated java class is meant to be run by java, and not used from python. Is there a way to make this work without rewriting my python code in java? ---- ha...@ot... x293 http://65.0.250.62/ |