I would like everyone to know that after my (long) easter holiday I have solved both my problems, and it is largely with help from you guys, so thanks all around!

To  "slow down" execution we ended up making a org.pyhton.core.TraceFunction and we used it in our parser with

Py.getThreadState().tracefunc = trace;

So far, this seems to be working splendidly.

As for Ians question, I could share how we solved our other problem of bundling jython with our jar:

We used Maven, and we added jython 2.5.0 as a dependency. Then we put the python standard library (the .py files) in a single archive, and we added this archive as a dependency also (this was a bit trickier) But from what I understand we could just as well have just put the whole standard library at the root level of our jar (for instance by using it as a resouce). But our way seems neater, as it is in a sense a library.
As for zip_safe and all that, I don't know what you are talking about. ;)

Hope maybe that helped, and thanks again.


On Mon, Apr 18, 2011 at 4:24 PM, Ian Stevens <i.stevens@syncapse.com> wrote:
Pierre, do you know what the other JAR bundling methods referenced in that Jython book are?

This is only one such technique used to make a JAR file for containing your applications. There are other ways to perform such techniques, but this seems to be the most straight forward and easiest to do.

Can anyone enlighten me as to what these other methods are, specifically with how third-party packages could be included in a standalone JAR? What about packages with zip_safe=True?

I attempted the following, but to no avail:

1. Grab a fresh jython.jar
2. Create a temporary Jython virtualenv.
3. jython setup.py install on my package
4. Add the contents of virtualenv/Lib/site-packages to Lib/site-packages in jython.jar

Running "java -cp jython.jar org.python.util.jython -c "import mypackage" results in an ImportError.

Ian.

On 2011-04-14, at 8:00 AM, Pierre Thibault wrote:

2011/4/14 Andreas Johnsen <osthekake@gmail.com>

2: We want to bundle Jython with our game in a single .jar file. The purpose would be for people to be able to "play" the game without having python installed on their computer. This would mean that we also would have to have the python standard library in the bundle. How do I make Jython look inside the jar when it is looking for .py files on import? I've been looking at sys.path and such, am I right in assuming that I will have to make my own module loader thingy, and add it somewhere? Does perhaps such a loader already exist?


A+

-------------
Pierre
My blog and profile (http://pierrethibault.posterous.com)
YouTube page (http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2)

<ATT00001..c><ATT00002..c>


------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users