David Griffin | 21 Aug 13:14

Catching errors in a embedded script at runtime

My app executes scripts at runtime, taken from files.
Each script is in essence a class definition based on an abstract
class in my Java.

So whatever is in the script, I know it should have a some key methods
defined in the abstract base class, and these are called from my java
code.

I read the script into my interpreter
   myInterpreter.execfile(scriptStream);
and this is void with no exceptions so I cannot really tell at that
point if script is OK

Then I get a reference for the class
  PyObject cls = interpreter.get(nameOfMyClass);
If cls != null then I think can be reasonably sure it found a valid
class in the interpreter namespace

I try to instantiate the class
  PyObject cls_instance = cls.__call__();

Then I convert that into a java object
 Object o = cls_instance.__tojava__(myAbstractClass.class);

If  o != Py.NoConversion  then I presumably have a usable java object.

I then cast  o   to (myAbstractClass) and I can start treating it as
an instance of myAbstractClass and call the base class methods.

This works a treat.
(Continue reading)

Melendez,Ulises | 21 Aug 07:28

removing DEBUG.class file

I’m using jython2.5a1, and it appears to be generating a file named DEBUG.class.  I’m assuming this is occurring because the alpha release has debug turned on.  What’s the best way to disable this behavior?

 

Thanks,

 

 

Ulises Melendez

ulises_melendez <at> securecomputing.com

954.375.3667

 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Mike Hostetler | 20 Aug 22:01

Re: Controlling .$py.class compiling


On Wed, Aug 20, 2008 at 1:25 PM, Leo Soto M. <leo.soto <at> gmail.com> wrote:

How about pre-compiling all your.py files to $py.class before
installing on the production environment? Would that work?

That's my Plan B. Doing that means I have to move more files over to production (both the .py and the $py.class files).  And, if the JRE changes, would those files get recompiled again?  If so, then they would change and I would have the same problems I just talked about.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Mike Hostetler | 20 Aug 19:36

Controlling .$py.class compiling

The good news is -- I finally convinced the Powers That Be that Jython was the right job for a solution.  Maybe me saying "It would take me three weeks in Java, but only two in Jython" helped my argument. :)

One issue that I do have is the .$py.class that Jython generates from .py files that it imports.  Our production environment is monitored for file changes.  So if Jython generates a $py.class file, we will receive a nasty-gram saying that we have added files. etc.  Is there a way to turn off the $py.class compilation?  Or does anyone have any other suggestions?

--
Mike Hostetler
http://mike.hostetlerhome.com/


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Josh Juneau | 20 Aug 13:20

Jython Monthly - Issue #21 - August 20, 2008

============================================
Jython Monthly - Issue #21 - August 20, 2008
URL: http://wiki.python.org/jython/JythonMonthly/Newsletters/August2008
Please send articles and news to:  juneau001 <at> gmail.com
============================================

Please read the complete newsletter by visiting the URL above.

I plan to revamp the Jython Monthly newsletter over the next month or two.
I'd like to try and spruce up the newsletter a bit and include a more
formal news
section each month. I am going over some ideas at this time, and if you have any
suggestions or things you'd like to see included, please send them my way.
Any feedback is appreciated.

Summary of August 2008 Contents:

News
====

Interview with Jim Baker - Jython Monthly Extra
http://wiki.python.org/jython/JythonMonthly/Interviews/August2008/JimBaker

Jython and Django on Glassfish - Scripting Project
https://glassfish-scripting.dev.java.net/discover/jython.html

More on Django and Jython - Leo Soto's Speaking at DjangoCon
http://wiki.python.org/jython/DjangoOnJython

Nbpython Project Progressing Quickly
https://nbpython.dev.java.net/

The Java Posse Made It To 200!
http://www.javaposse.com

Articles
======

*New* Jython Basics - Decorators
Submitted By:  Josh Juneau
http://wiki.python.org/jython/JythonMonthly/Articles/August2008/1

Jython Reborn - Chris McAvoy
http://www.developer.com/java/other/article.php/3748556

The A-Z of Programming Languages: Python
http://www.techworld.com.au/article/255835/-z_programming_languages_python?pp=1

Blogs
=====

Django on Jython, it's Here
http://blog.leosoto.com/2008/08/django-on-jython-its-here.html

Code Review With Rietveld
http://fwierzbicki.blogspot.com/2008/08/code-review-with-rietveld.html

Playing with JSqueak
http://blogs.sun.com/sundararajan/entry/playing_with_jsqueak

Jython Import Logic
http://blog.leosoto.com/2008/07/jython-import-logic.html

Books
====

New Python Book: Expert Python Programming - Tarek Ziade
http://tarekziade.wordpress.com/2008/08/08/a-new-python-book-expert-python-programming/

IDE
===

NbPython
https://nbpython.dev.java.net

Pydev 1.3.19
http://pydev.sourceforge.net/

============================================

View the Newsletter:
http://wiki.python.org/jython/JythonMonthly/Newsletters/August2008

Join the jython-users mailing list (jython-users <at> lists.sourceforge.net)
to subscribe.

=============================================
This issue of Jython Monthly was distributed by Josh Juneau.
Email: juneau001 <at> gmail.com
Blog:   http://jj-blogger.blogspot.com
http://www.gathereventplanning.com
=============================================

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
JLIST | 14 Aug 23:52

Packaging and deployment

Hi all,

Similar to Python, it seems that Jython applications are not that easy
to deploy. Too many files and directories. I wonder if there is a
solution to package all the directories and .py/class files in a
zip or jar file so that I just need to provide a couple of jar files
for deployment?

Thanks,
Jack

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Melendez,Ulises | 14 Aug 23:05

Does the jython interpreter open up any ports?

I’m trying to get approval for including Jython in our production environment, and one of the questions I’m being asked is whether the Jython interpreter that’s instantiated when embedding Jython in Java opens up any ports or is in any way accessible from outside the Java VM.  Can someone please confirm that the interpreter is not available outside the VM, and, specifically, that it does NOT listen on any ports?

 

Thanks,

 

 

Ulises Melendez

ulises_melendez <at> securecomputing.com

954.375.3667

 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Leo Soto M. | 14 Aug 00:58

Re: Problems with jython trunk and django 1.0 alpha 2

On Wed, Aug 13, 2008 at 5:50 PM, Rafael Ferreira <raf <at> ophion.org> wrote:

[...]

> Also, with regards to the data
> source configuration, is anyone working on a jdbc provider for django? I can
> prob take a crack at it if such thing doesn't exist already.

Yeah, look on <http://code.google.com/p/django-jython/> (you can also
easy_install it, if you have setuptools on your jython installation).

Currently, we have a very good PostgreSQL backend, and a experimental
one for SQLite3. It shouldn't be difficult at all to come up with
backends for MySQL and (perhaps on less degree) Oracle, considering
that the particular "dialect" problem for this databases is already
solved on the builtin Django backends. Contributions (after Monday,
which is the official end date for the GSoC coding period) are
welcomed :-)

--

-- 
Leo Soto M.
http://blog.leosoto.com

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Leo Soto M. | 13 Aug 15:59

Re: Problems with jython trunk and django 1.0 alpha 2

On Wed, Aug 13, 2008 at 1:59 AM, Rafael Ferreira <raf <at> ophion.org> wrote:
> On Mon, Aug 11, 2008 at 10:16 PM, Leo Soto M. <leo.soto <at> gmail.com> wrote:
> > On Tue, Aug 12, 2008 at 1:03 AM, Rafael Ferreira <raf <at> ophion.org> wrote:

[...]

> > > but when I go to run the build in developer server I get the
> > > following:
> > >
> > > rafael-mb:dj rafael$ jython manage.py runserver
> > > Traceback (most recent call last):
> > >   File "manage.py", line 4, in <module>
> > >     import settings # Assumed to be in the same directory.
> > > java.lang.ArrayIndexOutOfBoundsException: 51201
> > > at org.python.objectweb.asm.ClassReader.readClass(Unknown Source)
> > > at org.python.objectweb.asm.ClassReader.accept(Unknown Source)
> > > at org.python.objectweb.asm.ClassReader.accept(Unknown Source)
> > > at org.python.core.APIReader.<init>(APIReader.java:33)
> >
> > I think that this may be caused by some old *$py.class files. Can you
> > try to clean up all the generated $py.class files and run the server
> > again?
>
> so rm *class did the trick. The interesting thing tho is that if I run
>  "jython manage.py startapp blah" everything work just fine but I'm forced to
>  delete all the .class files again before being able to fire up runserver".
> Go figure..

That's weird, I can't reproduce this on my system. Not that I know how
to solve it, but I would try to do "svn up; ant clean; ant" to make
sure that the most recent version is what you are using.

If that doesn't work, can you please file a bug so we don't forget this?
--

-- 
Leo Soto M.
http://blog.leosoto.com

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Rafael Ferreira | 12 Aug 07:00

Problems with jython trunk and django 1.0 alpha 2

Guys, 

I'm using jython-asm trunk against the latest django release and everything kinda works but when I go to run the build in developer server I get the following:


rafael-mb:dj rafael$ jython manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 4, in <module>
    import settings # Assumed to be in the same directory.
java.lang.ArrayIndexOutOfBoundsException: 51201
at org.python.objectweb.asm.ClassReader.readClass(Unknown Source)
at org.python.objectweb.asm.ClassReader.accept(Unknown Source)
at org.python.objectweb.asm.ClassReader.accept(Unknown Source)
at org.python.core.APIReader.<init>(APIReader.java:33)
at org.python.core.imp.unmarshalCode(imp.java:117)
at org.python.core.imp.createFromPyClass(imp.java:90)
at org.python.core.imp.loadFromSource(imp.java:472)
at org.python.core.imp.find_module(imp.java:380)
at org.python.core.imp.import_next(imp.java:565)
at org.python.core.imp.import_name(imp.java:665)
at org.python.core.imp.importName(imp.java:725)
at org.python.core.ImportFunction.load(__builtin__.java:1227)
at org.python.core.ImportFunction.__call__(__builtin__.java:1223)
at org.python.core.PyObject.__call__(PyObject.java:251)
at org.python.core.__builtin__.__import__(__builtin__.java:1184)
at org.python.core.imp.importOne(imp.java:736)
at org.python.pycode._pyx0.f$0(manage.py)
at org.python.pycode._pyx0.call_function(manage.py)
at org.python.core.PyTableCode.call(PyTableCode.java:185)
at org.python.core.PyCode.call(PyCode.java:14)
at org.python.core.Py.runCode(Py.java:1200)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:155)
at org.python.util.jython.run(jython.java:220)
at org.python.util.jython.main(jython.java:110)

ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException: 51201


Any ideas?

- raf
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Leena Mansour | 11 Aug 18:12

instantiate python program inside java

Hello,
I don't know anything about python (I'm a student java coder), but I'm going to have to learn it since I can't do what I want in java.
Now the question is, is it possible to instantiate a whole python program inside java without turning the java files into .class files? so when I do something in the java program (click a button, etc..) the python program opens up?
Thanks!

--
LeEnA =)
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users

Gmane