#jython IRC Log

Index

IRC Log for 2014-02-21

Timestamps are in GMT/BST.

[0:02] * whgh (whg@nat/ibm/x-rvrvliexoajhmqzt) has joined #jython
[0:03] * whg (whg@nat/ibm/x-vebiolwccbqyrduh) Quit (Ping timeout: 240 seconds)
[0:03] * whgh is now known as whg
[0:03] * whg (whg@nat/ibm/x-rvrvliexoajhmqzt) Quit (Changing host)
[0:03] * whg (whg@unaffiliated/whg) has joined #jython
[0:03] * not-sure (48e1ae0c@gateway/web/freenode/ip.72.225.174.12) has joined #jython
[0:08] * enebo (~enebo@c-75-73-8-169.hsd1.mn.comcast.net) Quit (Quit: enebo)
[0:18] * zimmermann (~user@178-24-50-233-dynip.superkabel.de) Quit (Ping timeout: 248 seconds)
[0:50] <jimbaker> smaudet, agronholm - i'm not sure what's happening here, but in general we have very strong control of jython's call resolution
[0:50] <jimbaker> usually some sort of wrapper or conversion is all that's necessary
[0:51] <jimbaker> i would like to see the source python code to know for sure what's being tried; obviously https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java#L2108 is not super helpful
[0:51] <agronholm> indeed
[0:51] <agronholm> I already told smaudet that narrowing down the problem is necessary
[0:52] * not-sure (48e1ae0c@gateway/web/freenode/ip.72.225.174.12) Quit (Ping timeout: 245 seconds)
[0:57] * [Arfrever] (~Arfrever@apache/committer/Arfrever) Quit (*.net *.split)
[0:59] * [Arfrever] (~Arfrever@apache/committer/Arfrever) has joined #jython
[1:03] * [Arfrever] (~Arfrever@apache/committer/Arfrever) Quit (*.net *.split)
[1:04] * [Arfrever] (~Arfrever@apache/committer/Arfrever) has joined #jython
[1:09] * smaudet (~smaudet@cpe-98-28-34-149.columbus.res.rr.com) has joined #jython
[2:22] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython
[2:37] * smaudet (~smaudet@cpe-98-28-34-149.columbus.res.rr.com) Quit (Ping timeout: 246 seconds)
[2:53] * lheuer1 (~Adium@f048074010.adsl.alicedsl.de) has joined #jython
[2:55] * lheuer (~Adium@unaffiliated/lheuer) Quit (Ping timeout: 252 seconds)
[4:07] * lheuer1 (~Adium@f048074010.adsl.alicedsl.de) Quit (Quit: Leaving.)
[4:30] * robbyoconnor (~wakawaka@guifications/user/r0bby) Quit (Ping timeout: 264 seconds)
[5:50] * oscar_toro (~Thunderbi@h-17-170.a328.priv.bahnhof.se) has joined #jython
[6:35] * Oti (~ohumbel@adsl-89-217-115-73.adslplus.ch) has joined #jython
[6:39] * lheuer (~Adium@f048074010.adsl.alicedsl.de) has joined #jython
[6:39] * lheuer (~Adium@f048074010.adsl.alicedsl.de) Quit (Changing host)
[6:39] * lheuer (~Adium@unaffiliated/lheuer) has joined #jython
[7:09] * oscar_toro (~Thunderbi@h-17-170.a328.priv.bahnhof.se) Quit (Ping timeout: 248 seconds)
[7:32] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython
[9:49] * zimmermann (~user@178-24-50-233-dynip.superkabel.de) has joined #jython
[10:53] * lheuer (~Adium@unaffiliated/lheuer) Quit (Quit: Leaving.)
[13:58] * enebo (~enebo@c-75-73-8-169.hsd1.mn.comcast.net) has joined #jython
[14:48] * smaudet (~smaudet@206-51-157-254.nktelco.net) has joined #jython
[14:57] <smaudet> How can I add something to the classpath of Jython after I start the python runtime? I.e. as an option to the command prompt.
[14:58] <smaudet> I can do java -cp but then i have to put jython on the classpath as well and explicitly specify the jython start file, which is not very nice.
[15:05] * Mark___ (82a7edb9@gateway/web/freenode/ip.130.167.237.185) has joined #jython
[15:06] * Mark___ (82a7edb9@gateway/web/freenode/ip.130.167.237.185) Quit (Client Quit)
[15:07] * mark___ (82a7edb9@gateway/web/freenode/ip.130.167.237.185) has joined #jython
[15:08] * mark___ (82a7edb9@gateway/web/freenode/ip.130.167.237.185) has left #jython
[15:10] * mark___ (82a7edb9@gateway/web/freenode/ip.130.167.237.185) has joined #jython
[15:11] <mark___> hello?
[15:11] <mark___> Ah - figured out the freenode webchat irc client
[15:12] <mark___> Can anybody tell me if Jython is an active project? According to the FAQ, the last release was in 2009, so presumably it does not have some of the newest python language structures.
[15:32] <smaudet> mark___: A) Software doesn't 'rot'. Good logic then is good logic now. This concept of inactive projects being bad is ludicrous, unless you're looking at it from a support standpoint.
[15:32] <smaudet> B) Did you check the wiki? its edited very recently (last September)
[15:33] <smaudet> C) See A) - new 'active' projects have a likelyhood of being worse than old inactive ones, unless they've been around for a long while or are forks.
[15:34] <mark___> I went to jython.org, clicked the link for FAQ, and then clicked the first link in the FAQ (GeneralInfo). It was last edited 2012-03-03 and the question "What is the current status of Jython?" shows "Jython 2.5.1 was release on September 26, 2009."
[15:35] <mark___> I know that software doesn't rot, but the world changes around it.
[15:35] <smaudet> mark___ the world changes but it follows the same rules that it always did. Logical rules at least.
[15:36] <smaudet> And more often than not people re-invent the wheel.
[15:36] <mark___> For example, if I have python code that says "except Exception as e:", it won't compile in an interpreter written to match CPython 2.5. If I have python code that uses that syntax, I can't use an interpreter that doesn't recognize it.
[15:36] <smaudet> And in case you actually bothered to look at the downloads, you'll notice that FAQ entry is old.
[15:37] <smaudet> Sure, so you can only run that software on Python 2.5. Or update like maybe one line of platform specific code.
[15:38] <smaudet> And I said Good Code - Bad code then is equally bad code now.
[15:38] <smaudet> That's an example of platform dependency, and is always bad.
[15:39] <mark___> Yes, the FAQ entry doesn't mention the 2.5.3 release or the release candidate and beta releases shown on the download pages. But there are no dates on that page.
[15:40] <mark___> Yes, I recognize that "except Exception as e" means you need python 2.6 or later, but I can't help the fact that I depend on third party packages that assume python 2.6. I also can't go through all our software and change hundreds of places where the exception has been written with the newer syntax.
[15:41] <smaudet> Anyways doing what you're trying to do is stupid, use it, if it works great, if not, sorry. I'm not part of this project.
[15:41] <smaudet> There are active people around though - I had a question answered yesterday.
[15:41] <mark___> What am I doing that is stupid?
[15:41] <smaudet> Metering via age.
[15:42] <mark___> So my assumption that software release in 2009 probably does not have features that were invented in 2010 is stupid?
[15:43] <smaudet> Your assumption that you need those features from 2010 is stupid - or misguided at least. Anyways I'm not here to argue - take your dislike for old software elsewhere, I'm not going to discuss this further.
[15:45] <mark___> I still appreciate your response. Thanks for the information about jython.
[15:45] <mark___> Bye.
[15:45] * mark___ (82a7edb9@gateway/web/freenode/ip.130.167.237.185) Quit (Quit: Page closed)
[16:04] <smaudet> agronholm: Managed to debug the ReflectedArgs class - I believe the error message is misleading, the error is unrelated to the given message.
[16:14] <smaudet> agronholm: confirmed this was an issue
[16:16] <smaudet> agronholm: I didn't spend a lot of time looking at the source of the error, but the problem is in the loop at line 152 in org.python.core.ReflectedArgs, its probably line 156 that is amiss, it looks like the javaArgs are overwriting one another if an error is found, so the print message throws an error for arguments that are not incorrect. I may file a bug later.
[16:30] * robbyoconnor (~wakawaka@guifications/user/r0bby) Quit (Ping timeout: 252 seconds)
[16:59] <smaudet> agronholm: another issue - there seem to be problems putting multiple jars in the classpath when using jython...
[17:02] <smaudet> nvm just a typo :)
[17:16] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython
[17:31] * robbyoconnor (~wakawaka@guifications/user/r0bby) Quit (Ping timeout: 252 seconds)
[17:32] * Oti (~ohumbel@adsl-89-217-115-73.adslplus.ch) Quit (Ping timeout: 265 seconds)
[18:04] <jimbaker> FAQs should certainly be updated... right now, i'm focusing on that code side of things ;)
[18:07] <jimbaker> smaudet, so what's up with jars in classpath? that should work well, other than the craziness jeff allen recently identified
[18:19] <smaudet> jimbaker: I don't know. Basically (I'm testing against Jackson), if I run:
[18:20] <smaudet> java -cp .;jackson-annotations-2.2.3.jar;jackson-core-2.2.3.jar;jackson-databind-2.2.3.jar;jython-standalone-2.7-b1.jar org.python.util.jython -m cpathtests
[18:20] <smaudet> it works
[18:20] <smaudet> if I do:
[18:20] <smaudet> java -cp .;jackson-annotations-2.2.3.jar;jackson-core-2.2.3.jar;jackson-databind-2.2.3.jar -jar jython-standalone-2.7-b1.jar -m cpathtests
[18:20] <smaudet> it doesn't
[18:21] <jimbaker> smaudet, ahh, that makes sense. java doesn't allow the later case
[18:21] <jimbaker> running with -jar means you only have one jar
[18:21] <jimbaker> and it will ignore -cp/-classpath
[18:22] <smaudet> hmm, ok - sorry 'bout that then!
[18:22] <jimbaker> smaudet, speaking of such things, you might be interested in the clamp project, as described here, https://github.com/jimbaker/clamped
[18:23] <jimbaker> we don't yet have annotations support, but it will happen shortly. probably sometime next month, now that socket-reboot is mostly done in terms of functionality
[18:23] <jimbaker> but it has good support for jar packaging
[18:24] <smaudet> jimbaker: while I've got you, is there a Util for turning Python classes into Java ones?
[18:24] <smaudet> Or is that not possible
[18:24] <jimbaker> smaudet, that would be clamp
[18:24] <smaudet> Aha! I hadn't got that far, thanks! :)
[18:24] <jimbaker> see the first example: import bar.clamped.BarClamp; // yes, you can now just import Python classes!
[18:25] <jimbaker> smaudet, as far as your java code is concerned, assuming it's not doing heavy introspection, these are plain old java classes
[18:25] <jimbaker> we also plan to support true POJO support as well
[18:26] <smaudet> Neat.
[18:27] <smaudet> Its good to know there's someone working on it at least - its nice enough I was gonna start diving and fixing bugs myself if I find that I need to, its been pretty fun for prototyping and testing Java interfaces. :)
[18:27] <jimbaker> smaudet, contributors certainly welcome here, https://github.com/jythontools/
[18:28] <jimbaker> smaudet, i find it fun that we can almost entirely do this in python; so far the java pieces are jython core, although we may eventually add to clamp as well - it looks like all necessary hooks are complete
[18:29] <jimbaker> including of course use of ASM
[18:29] * sinistersnare (~sinisters@pool-108-28-93-153.washdc.fios.verizon.net) Quit (Ping timeout: 272 seconds)
[18:31] <smaudet> Of course. I'm using it on Tomcat atm, really helps with the deploy/compile cycle. About the only thing I need personally is a good py2java compiler - I'm kinda doing this under the radar to evaluate things - but if its seamless I might be able to get people to sign on to using it.
[18:32] * srcerer (~chatzilla@dns2.klsairexpress.com) has joined #jython
[18:32] <smaudet> Anyways thanks!
[18:33] * srcerer (~chatzilla@dns2.klsairexpress.com) Quit (Client Quit)
[18:33] <jimbaker> smaudet, fantastic. please feel free to stop by here and raise any ideas/bugs, this is the best place to do it
[18:34] * srcerer (~chatzilla@dns2.klsairexpress.com) has joined #jython
[18:35] <jimbaker> re py2java, i think clamp basically does that. so you can do stuff like $ jython setup.py install singlejar
[18:36] <jimbaker> and that will construct an appropriate single jar. it would not be much more work for the singlejar command to support building out a war for tomcat instead
[18:37] <jimbaker> the other thing i have played around with a bit is bundling in maven support into clamp so it can resolve any maven artifacts it depens on
[18:42] * sinistersnare (~sinisters@pool-108-28-93-153.washdc.fios.verizon.net) has joined #jython
[18:45] * lheuer (~Adium@unaffiliated/lheuer) has joined #jython
[19:08] <jimbaker> smaudet, https://github.com/jythontools/clamp/issues/8 - please update as it makes sense
[19:09] <smaudet> jimbaker: ok, cool, thanks!
[19:09] <smaudet> I will update as I progress.
[19:10] <jimbaker> smaudet, cool. i had to first figure out how to turn on issues reporting for github - apparently toplevel projects do not have this set up automatically
[19:10] <jimbaker> simple enough once i found the appropriate settings page
[20:20] * sidrero (~sidrero@80-218-33-57.dclient.hispeed.ch) has joined #jython
[20:20] <sidrero> hello
[20:21] <sidrero> question:
[20:21] <sidrero> on java
[20:21] <sidrero> I have an array Object[][]
[20:21] <sidrero> so that some elements are nulls
[20:21] <sidrero> for example
[20:21] <sidrero> [[1,null,2],[1,null,2]]
[20:22] <sidrero> then I want to put that into a jython List
[20:22] <sidrero> so I create a new PyList
[20:22] <sidrero> and then inside that another PyList
[20:22] <sidrero> I cann add or append let's say 1
[20:22] <sidrero> then null
[20:22] <sidrero> but then the 2
[20:22] <sidrero> either fails or succed , in a very erratic way
[20:23] <sidrero> but then causes problems
[20:23] <sidrero> any idea how to fix that?
[20:26] <sidrero> something like that
[20:26] <sidrero> Object[][] JavaArray = new Object[2][3];
[20:26] <sidrero> JavaArray[0][0] = 1;
[20:26] <sidrero> JavaArray[0][1] = null;
[20:26] <sidrero> JavaArray[0][2] = 2;
[20:26] <sidrero> JavaArray[1][0] = 1;
[20:26] <sidrero> JavaArray[1][1] = null;
[20:26] <sidrero> JavaArray[1][2] = 2;
[20:26] <sidrero> PyList JythonList = new PyList();
[20:26] <sidrero> for(int rows = 0; rows<JavaArray.length;rows++){
[20:26] <sidrero> //System.out.println(String.valueOf(rows));
[20:26] <sidrero> Object[] currow = JavaArray[rows];
[20:26] <sidrero> PyList Jyrow = new PyList();
[20:26] <sidrero>
[20:26] <sidrero> for (int cols = 0; cols<currow.length;cols++){
[20:26] <sidrero> System.out.println(String.valueOf(rows) + " " + String.valueOf(cols));
[20:26] <sidrero> Jyrow.add(currow[cols]);
[20:26] <sidrero> }
[20:26] <sidrero> JythonList.append(Jyrow);
[20:26] <sidrero> }
[20:27] <sidrero> and I get this:
[20:27] <sidrero> 0 0
[20:27] <sidrero> 0 1
[20:27] <sidrero> Exception in thread "main" java.lang.NullPointerException
[20:27] <sidrero> at org.python.core.PyJavaType.wrapJavaObject(PyJavaType.java:85)
[20:27] <sidrero> at org.python.core.adapter.ClassicPyObjectAdapter.adapt(ClassicPyObjectAdapter.java:124)
[20:27] <sidrero> at org.python.core.Py.java2py(Py.java:1590)
[20:27] <sidrero> at org.python.core.PyList.add(PyList.java:941)
[20:27] <sidrero> at Main.main(Main.java:61)
[20:31] <sidrero> the same if I try to append a py.none
[20:31] <sidrero> help please!
[20:36] <sidrero> However, if I do it in a script, it works well
[20:36] <sidrero> inputList = list()
[20:36] <sidrero> for row in range(0,2):
[20:36] <sidrero> newrow = list()
[20:36] <sidrero> newrow.append(1)
[20:36] <sidrero> newrow.append(None)
[20:36] <sidrero> newrow.append(2)
[20:36] <sidrero> inputList.append(newrow)
[20:36] <sidrero> print inputList
[20:37] <sidrero> [[1, None, 2], [1, None, 2]]
[20:42] <sidrero> IF I do this:
[20:42] <sidrero> for(int rows = 0; rows<JavaArray.length;rows++){
[20:42] <sidrero> //System.out.println(String.valueOf(rows));
[20:42] <sidrero> Object[] currow = JavaArray[rows];
[20:42] <sidrero> PyList Jyrow = new PyList();
[20:42] <sidrero>
[20:42] <sidrero> for (int cols = 0; cols<currow.length;cols++){
[20:42] <sidrero> System.out.println(String.valueOf(rows) + " " + String.valueOf(cols));
[20:42] <sidrero> if (currow[cols] != null){
[20:42] <sidrero> Jyrow.append(new PyFloat((Integer)currow[cols]));
[20:42] <sidrero> }
[20:42] <sidrero> else{
[20:42] <sidrero> Jyrow.append(Py.None);
[20:42] <sidrero> }
[20:42] <sidrero> }
[20:42] <sidrero> JythonList.append(Jyrow);
[21:05] <jimbaker> sidrero, could you place that here - https://gist.github.com/ - hard to follow
[21:09] <sidrero> sure, sorry
[21:11] <sidrero> https://gist.github.com/anonymous/9143580
[21:11] <sidrero> there it is
[21:17] <jimbaker> sidrero, rather than writing your own conversion, i would recommend using something like http://www.jython.org/javadoc/org/python/core/Py.html#tojava(org.python.core.PyObject, java.lang.Class)
[21:19] <jimbaker> actually you want the reverse i believe. also in org.python.core.Py - http://www.jython.org/javadoc/org/python/core/Py.html#java2py(java.lang.Object)
[21:27] <sidrero> what I need is transform a java array to PyList
[21:29] <sidrero> seems I can convert java array to PyArray with java2py
[21:40] <sidrero> well, this is complicated
[21:51] <sidrero> does not seem to work weel for an array [][]
[21:53] <sidrero> anyway, I did not know about that method, thanks a lot jim!
[21:53] * sidrero (~sidrero@80-218-33-57.dclient.hispeed.ch) Quit ()
[21:53] <jimbaker> maybe construct a java.util.ArrayList from the array, then try the conversion
[22:29] * smaudet (~smaudet@206-51-157-254.nktelco.net) Quit (Ping timeout: 246 seconds)
[23:12] * vIkSiT (~vIkSiT|2@unaffiliated/viksit) has joined #jython

Index

These logs were automatically created by JythonLogBot on irc.freenode.net using a slightly modified version of the Java IRC LogBot.