Hasan Diwan | 1 Dec 04:14
Picon

Re: Jython & Java Collections....

2009/11/30 Cliff Hill <xlorep <at> darkhelm.org>:
> I'm curious, and without testing it out myself, I wonder if Jython
> "gracefully" handles the Java Collections of Sets and Maps, so that I can
> simply treat them as Python sets and dicts.

I didn't see anything when I looked through the jython source, so I've
put up some code at http://hasandiwan.info for maps[1] and sets[2].
Hope it helps.
--

-- 
Sent from my mobile device
Envoyait de mon telephone mobil

1. http://hasandiwan.info/2009/11/how-to-view-java-maps-as-python-dictionaries.html
2. http://hasandiwan.info/2009/11/how-to-view-java-sets-as-pythons-sets.html

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
Hasan Diwan | 1 Dec 05:34
Picon

Re: Jython & Java Collections....

2009/11/30 Hasan Diwan <hasan.diwan <at> gmail.com>:
> I didn't see anything when I looked through the jython source.

On second glance, it appears to work. My code, however, has a bug,
throwing NoSuchElementException as soon as Iterator.hasNext() is
False. Would appreciate help with the solution. Many thanks in
advance.
--

-- 
Sent from my mobile device
Envoyait de mon telephone mobil

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
Alan Kennedy | 1 Dec 11:08
Favicon
Gravatar

Re: Accessing Standard Library when Jython is embedded

[Brian]
> I've add the contents of jython.jar into the application's jar and am able
> to invoke a PythonIntepreter on scripts also contained within the jar.  I
> run into problems however when I try to use the Jython/Python standard
> library.  import sys works but import os fails, presumably because
> jython.jar does not contain the standard library?  I've tried adding the
> standard library (the Lib directory under c:\jython) but I can't seem to
> figure out where to put it in the application jar so that the
> PythonInterpreter can see it.  I've tried simply creating a directory \MyLib
> and adding it to the sys.path but this doesn't seem to work.  Any ideas?

Have you tried using the standalone version of jython?

If you select the "standalone" installation of jython, then the
resulting jar installed on your system contains the Lib/ directory
within the jar.

http://wiki.python.org/jython/InstallingJython

HTH,

Alan.

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
joe438 | 1 Dec 22:51
Picon
Favicon

Scientific Applets with Jython


I am a theoretical physicist. Over the last years I've developed many Matlab
programs to simulate several physical systems. Now,I would like to put them
on my webpage so that anyone can run my simulations online as Applets. As
far as I know, the best tool I can use to achieve this is Jython, because it
offers the scientific power of Python along with the versatility of Java. In
addition, Matlab comes with a Java compiler, so that I can export the
majority of my functions to .jar files for a less painful conversion. Before
I start studying how Jython works, I would like to know if you think that I
am on the right track, or maybe I'm missing something or there is an easier
way to do this... I am not a programmer so any suggestion regarding what I
should concentrate on would be highly appreciated.
Many thanks!
Josep
Barcelona, Spain
--

-- 
View this message in context: http://old.nabble.com/Scientific-Applets-with-Jython-tp26557491p26557491.html
Sent from the jython-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
Larry Riedel | 1 Dec 23:10

Re: Scientific Applets with Jython

> [Jython] offers the scientific power of Python

I think right now much of the scientific power of
Python is in extension libraries not available via
Jython as they are in CPython.

> I would like to know if you think that I am on
> the right track

Jython seems like an interesting way to wrap
and glue MATLAB scripts without having to get
into programming in a fussy language like Java.

Larry

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
Cliff Hill | 2 Dec 01:20
Favicon
Gravatar

Re: Jython & Java Collections....

That actually is a bug I already reported to the Jython project. There apparently is some issues with Java Iterators in Jython 2.5.x it seems...

On Mon, Nov 30, 2009 at 8:34 PM, Hasan Diwan <hasan.diwan <at> gmail.com> wrote:
2009/11/30 Hasan Diwan <hasan.diwan <at> gmail.com>:
> I didn't see anything when I looked through the jython source.

On second glance, it appears to work. My code, however, has a bug,
throwing NoSuchElementException as soon as Iterator.hasNext() is
False. Would appreciate help with the solution. Many thanks in
advance.
--
Sent from my mobile device
Envoyait de mon telephone mobil

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users



--
"I'm not responcabel fer my computer's spleling errnors" - Xlorep DarkHelm
Website: http://darkhelm.org

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Jan Wedel | 2 Dec 08:22
Picon

Introduction to the customizable proxymaker?

Hi!

 

I actually posted my question in the clamp “thread” but I guess opening a new thread would potentially make more people answering J

 

Below, you will find the reply from Charlie groves and below that my questions follows. I’d appreciate, if you have an answer or any helpful comment.

 

> Actually, clamp isn't needed for your use case.  Clamp lets you put

> decorators on python classes to turn them into something callable from

> Java.  If you're just trying to extend a Java class, you just need the

> ability to statically compile and name those proxies.  Clamp needed

> that as well, which is why the two keep getting conflated.

>

> Well, the majority of the work is already available in the

> customizable-proxymaker branch in the jython repository.  That already

> contains the static compilation you need.

> The major work remaining there for

> your use case is a) adding a tool to take advantage of the static

> proxy compilation and b) using that to visit all the classes in the

> standard lib that need it and make  static proxies for them.

 

Ah, Ok...I have a vague idea of what I could do. But still, despite the fact that it's not completed yet, would't it be easier for me to use clamp by adding annotations to the python code than to write new tools to statically change the class proxies.

 

However, I checked out the code from the branch and I compiled it. But what now? :) I know, to answer such a question would be very time-consuming for you and you already drew a rough sketch. But I am currently sitting in front of huge stack of source files and don't know where to start. I would need some kind of entry point ;) Here are some questions that fly around in my head:

 

1.) At first, to fulfill a) can I use the resulting jython.jar file from that customizable-proxymaker branch build and create an external app? Or do I have to somehow "hook" into the existing code? If yes, how would I trigger that? By using compileall? What if I don't want to expose all methods?

2.) I think I need to understand the code structure and hierarchy of jython/proxymaker i.e. "what does what and when does it 'that'?" To do that, could you please tell me which class is the main entry point for the proxymaker? I saw that you modified some classes in the org.python.exposed package but couldn't identify a main class from which I could start studying...

 

Thanks in advance!

 

Jan

 

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Leinartas, Michael | 2 Dec 19:26
Picon
Favicon

imp module only seems to work for builtins

I can't seem to get imp.find_modules to return anything except builtin modules.  If I try and import
anything from javaland I get an ImportError. I haven't found any bugs that address this, does this appear
to be one?

>>> import imp
>>> imp.find_module('subprocess')
(<open file '<Java InputStream 'java.io.FileInputStream <at> f4ca49' as file>', mode 'r' at 0x1>,
'/opt/orbitz/tools/lib/jython/Lib/subprocess.py', ('.py', 'r', 1))
>>> imp.find_module('sys')
(None, 'sys', ('', '', 6))
>>> imp.find_module('java.lang.Object')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named java.lang.Object
>>> imp.find_module('java.util')        
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named java.util
>>> import java.lang.Object
>>> java.lang.Object
<type 'java.lang.Object'>
>>> imp.find_module('org.python.core')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named org.python.core
>>> import org.python.core
>>> org.python.core
<java package org.python.core 0x3>

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
Philip Yi | 4 Dec 13:58
Picon

Problem using super() to call Java method

Hi

The attached code results in the following error:

.....
MyDocument.insertUpdate entered
MyDocument.insertUpdate entered
MyDocument.insertUpdate entered
.....

RuntimeError: maximum recursion depth exceeded

It appears that instead of calling the super (PlainDocument in this case) method, it recursively calls
MyDocument method.

Is this a jython bug?

cheers

Attachment (MyDocument.py): application/octet-stream, 406 bytes
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Tobias Ivarsson | 4 Dec 16:39
Picon
Gravatar

Re: Problem using super() to call Java method

Yes, this is a bug. I don't know if there is an open issue for this already, but there are open issues on related topics, it will get fixed, but its a pretty tricky case (protected method accessed via reflection) so I cannot give you an estimate on when this will be done.


Cheers,
Tobias

On Fri, Dec 4, 2009 at 1:58 PM, Philip Yi <philipyi <at> mac.com> wrote:
Hi

The attached code results in the following error:

.....
MyDocument.insertUpdate entered
MyDocument.insertUpdate entered
MyDocument.insertUpdate entered
.....

RuntimeError: maximum recursion depth exceeded

It appears that instead of calling the super (PlainDocument in this case) method, it recursively calls MyDocument method.

Is this a jython bug?

cheers


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users

Gmane