#jython IRC Log


IRC Log for 2014-12-01

Timestamps are in GMT/BST.

[10:29] * mbooth (~mbooth@redhat/mbooth) Quit (Remote host closed the connection)
[10:32] * mbooth (~mbooth@redhat/mbooth) has joined #jython
[13:57] * jimbaker (~jbaker@python/psf/jimbaker) has joined #jython
[14:54] * xemdetia (xemdetia@nat/ibm/x-opnmznnwuvosyrvp) has joined #jython
[14:56] <jimbaker> back from vacation. fantastic early season snow here in the colorado high country, i had a great time skiing, snowshoeing, and just being outside in the mountains
[15:33] * xemdetia (xemdetia@nat/ibm/x-opnmznnwuvosyrvp) Quit (Remote host closed the connection)
[15:39] * xemdetia (xemdetia@nat/ibm/x-yvlbojwynlwdwmxz) has joined #jython
[18:09] * fwierzbicki1 (~Adium@99-106-169-5.lightspeed.sntcca.sbcglobal.net) Quit (Read error: Connection reset by peer)
[18:09] * fwierzbicki (~Adium@99-106-169-5.lightspeed.sntcca.sbcglobal.net) has joined #jython
[18:10] * fwierzbicki1 (~Adium@99-106-169-5.lightspeed.sntcca.sbcglobal.net) has joined #jython
[18:10] * fwierzbicki (~Adium@99-106-169-5.lightspeed.sntcca.sbcglobal.net) Quit (Read error: Connection reset by peer)
[18:18] <peke_> jimbaker: sounds great! when does skiing season end there? a client just asked would i be interested to organize a training at their boulder site.
[18:19] <jimbaker> peke_, it can go as late as early july :), but to be safe, end of april
[18:20] <jimbaker> feb - early april is the best time of year however. it would be great to see you here!
[18:26] <peke_> jimbaker: cool! i'll let you know how things proceed. would definitely love to come and stay a little extra to ski and to hack jython, but with smallish kids staying longer time away from home is somewhat problematic.
[18:27] <jimbaker> peke_, sounds great! keep me posted on what your schedule looks like, but this sounds like an awesome plan even if it's just an extra day (or two)
[18:54] * Arfrever (~Arfrever@apache/committer/Arfrever) Quit (Remote host closed the connection)
[19:35] * Arfrever (~Arfrever@apache/committer/Arfrever) has joined #jython
[20:02] * xemdetia_ (xemdetia@nat/ibm/x-zpsjhslgsoblocdv) has joined #jython
[20:05] * xemdetia (xemdetia@nat/ibm/x-yvlbojwynlwdwmxz) Quit (Ping timeout: 245 seconds)
[20:09] * fwierzbicki1 (~Adium@99-106-169-5.lightspeed.sntcca.sbcglobal.net) Quit (Read error: Connection reset by peer)
[20:43] * xemdetia__ (xemdetia@nat/ibm/x-llymrnamfgruttie) has joined #jython
[20:47] * xemdetia_ (xemdetia@nat/ibm/x-zpsjhslgsoblocdv) Quit (Ping timeout: 258 seconds)
[20:50] * xemdetia__ is now known as xemdetia
[21:09] * s1k3s (567e3fac@gateway/web/freenode/ip. has joined #jython
[21:09] <s1k3s> hello
[21:10] <s1k3s> how do I add new python modules, so it can be recognized inside my jython java program?
[21:11] * AndyBotwin (~botwin@ has joined #jython
[21:11] * AndyBotwin (~botwin@ Quit (Changing host)
[21:11] * AndyBotwin (~botwin@unaffiliated/andybotwin) has joined #jython
[21:13] * mbooth (~mbooth@redhat/mbooth) Quit (Ping timeout: 240 seconds)
[21:19] * fwierzbicki (~Adium@99-106-169-5.lightspeed.sntcca.sbcglobal.net) has joined #jython
[21:22] * chrisseaton_ (sid38584@gateway/web/irccloud.com/x-fziuswpqraoofhba) has joined #jython
[21:28] * mbooth (~mbooth@cpc68386-shef10-2-0-cust10.17-1.cable.virginm.net) has joined #jython
[21:28] * mbooth (~mbooth@cpc68386-shef10-2-0-cust10.17-1.cable.virginm.net) Quit (Changing host)
[21:28] * mbooth (~mbooth@redhat/mbooth) has joined #jython
[21:29] * s1k3s (567e3fac@gateway/web/freenode/ip. Quit (Quit: Page closed)
[21:31] * JStoker (jstoker@unaffiliated/jstoker) Quit (Killed (wolfe.freenode.net (Nickname regained by services)))
[21:31] * JStoker (jstoker@unaffiliated/jstoker) has joined #jython
[21:35] * chrisseaton (sid38584@gateway/web/irccloud.com/x-fyyjwyiezyidjfug) Quit (*.net *.split)
[21:35] * siel (~siel@unaffiliated/motley) Quit (*.net *.split)
[21:35] * paolo (~paolo@unaffiliated/paolo) Quit (*.net *.split)
[21:37] * chrisseaton_ is now known as chrisseaton
[22:22] * scohen (c6bbdf01@gateway/web/freenode/ip. has joined #jython
[22:24] * scohen (c6bbdf01@gateway/web/freenode/ip. Quit (Client Quit)
[22:27] * xemdetia (xemdetia@nat/ibm/x-llymrnamfgruttie) Quit (Ping timeout: 264 seconds)
[22:29] * paolo_ (~paolo@2a03:8180:1001:b2:25::12c) has joined #jython
[22:32] * paolo_ is now known as paolo
[22:32] * paolo (~paolo@2a03:8180:1001:b2:25::12c) Quit (Changing host)
[22:32] * paolo (~paolo@unaffiliated/paolo) has joined #jython
[22:34] * tactevo (~tactevo@c-24-6-253-119.hsd1.ca.comcast.net) has joined #jython
[22:35] <tactevo> Hello, anyone here who might help me with a java.library.path issue?
[22:35] * siel (~siel@unaffiliated/motley) has joined #jython
[22:39] * icecreamcohen (~stevecohe@808.pinadmin.com) has joined #jython
[22:40] <icecreamcohen> hey, does anyone here have any experience with jython and locales?
[23:01] <jimbaker> icecreamcohen, we have been improving locale support... anything specific?
[23:01] <icecreamcohen> sure, jimbaker???
[23:01] <icecreamcohen> so I have a java app with a python piece
[23:02] <icecreamcohen> I???m using a python interpreter, and I???d like to be able to set the locale in the interpreter so that the messages it emits are properly translated.
[23:02] <jimbaker> tactevo, re java.library.path - that's more of a jvm issue i would think
[23:02] * icecreamcohen (~stevecohe@808.pinadmin.com) has left #jython
[23:03] * icecreamcohen (~stevecohe@808.pinadmin.com) has joined #jython
[23:03] <icecreamcohen> does that make sense?
[23:04] <jimbaker> icecreamcohen, it makes sense, just don't know what we provide to support this sort of usage, vs from the jython wrapper inheriting the locale
[23:05] <icecreamcohen> is there another option for setting the locale with an embedded interpreter?
[23:08] <icecreamcohen> jimbaker, so setlcale is off limits?
[23:09] <tactevo> jimbacker, the problem is this: I have a jar that depends on shared libraries. The jvm java.library.path needs to be set for the classes to load the shared libraries. I can do that directly using java -Djava.library.path=... -jar jython.jar, but the same thing does not work if i use the -Djava.library.path with jython directly or if I set the java.library.path dynamically inside of a jython program using
[23:09] <tactevo> java.lang.System.getProperty('java.library.path'.
[23:10] <tactevo> oops.. typo.. that last line should have read.. java.lang.System.SetProperty (not get)
[23:11] <tactevo> but when I do 'get' the java.library.path using jython code, the path is correct in each case... but it only works when set directly in the jvm when launching with java.
[23:11] <jimbaker> tactevo, -D args should be passed through by the jython wrapper script. you can see exactly what it will do by adding --print
[23:11] <tactevo> ok.. i'll check that.. thanks!
[23:13] <jimbaker> tactevo, however, i just tried that - it looks like the args will go through to python args. try doing this -J-Dfoo=bar
[23:13] <jimbaker> that will ensure -Dfoo=bar is set for java
[23:13] <tactevo> ok
[23:16] <tactevo> wahoo! That worked.. Thanks Jim!!
[23:16] <jimbaker> icecreamcohen, i don't think this is supported in the way you want it. we have a fallback support to C locale for formatting. but nothing that connects this with actual implementation against java.text/java.util
[23:16] <jimbaker> the locale i was thinking about was encoding support - that has greatly improved
[23:16] <icecreamcohen> can I bounce an idea off of you?
[23:18] <icecreamcohen> or not??? I might be able to work around this by reimplementing ugettext
[23:23] <jimbaker> icecreamcohen, in django? that could make sense
[23:24] <icecreamcohen> nah, there???s no django here. I???m running a custom that does the heavy lifting in java and some lightweight building of on-site notifications in python.
[23:24] <icecreamcohen> it???s just classes
[23:24] <icecreamcohen> right now I???m only using ngettext and gettext, and I was thinking I could use https://code.google.com/p/gettext-commons/ to emulate gettext
[23:24] <jimbaker> icecreamcohen, i don't think this would be terribly difficult to fix locale.py so that it uses java.text/java.util, but i'm not at all familiar with these libraries
[23:24] <jimbaker> (not yet at least...)
[23:25] <icecreamcohen> I think it would be slightly tricky, because there are some other things (like gettext) that depend on them.
[23:25] <icecreamcohen> jimbaker, I could do an experiment by making a _locale.py file
[23:25] <jimbaker> icecreamcohen, ahh, i see - so this is the missing piece
[23:25] <jimbaker> icecreamcohen, exactlyh
[23:26] <jimbaker> and it's apache licensed, so we could incorporate if it works
[23:26] <icecreamcohen> yeah
[23:26] <icecreamcohen> I???ll keep you posted on how it goes, jimbaker.
[23:26] <icecreamcohen> Thanks for your help.
[23:27] <jimbaker> icecreamcohen, thanks! this would be a great addition
[23:27] <icecreamcohen> I pretty much thought that locale support wouldn???t work properly in jython using an interpreter.
[23:27] <icecreamcohen> We owe you guys a bunch for this.
[23:27] <icecreamcohen> this is our first hybrid python/java service.
[23:28] <icecreamcohen> jimbaker, how much do you know about the PythonInterpreter?
[23:28] <icecreamcohen> I???m wondering how theadsafe it is.
[23:36] <tactevo> jimbaker, in case you're interested. I just found out that you can't change the java.library.path system property at run time because it is read-only. I also found a workaround. http://fahdshariff.blogspot.jp/2011/08/changing-java-library-path-at-runtime.html
[23:38] <jimbaker> icecreamcohen, what do you mean by threadsafe for PythonInterpreter? it's just a wrapper of PySystemState (or sys from python code)
[23:38] <icecreamcohen> it goes back to the setlocale() function???
[23:39] <icecreamcohen> hmm??? maybe this isn???t the right question.
[23:39] <icecreamcohen> let???s say I have a mapping of keys to pyobjects
[23:39] <jimbaker> so that would be global to PySystemState
[23:39] <jimbaker> but you can multiples
[23:40] <icecreamcohen> ok, and then each pyobject would not be threadsafe
[23:40] <jimbaker> tactevo, makes sense re java.library.path - fortunately the jython startup script is written in bash for such reasons
[23:42] <jimbaker> icecreamcohen, reading https://docs.python.org/2/library/locale.html#locale.setlocale docs... we can readily make it threadsafe, but this still a global setting for that global namespace (= PySystemState instance), due to the design of this module
[23:43] <icecreamcohen> that???s what I???m asking ;)
[23:43] <jimbaker> so if two threads are trying to set it... they can see races
[23:43] <jimbaker> even though it will not blow up
[23:43] <jimbaker> (because we made it "threadsafe")
[23:43] <icecreamcohen> so each thread needs its own PyInterpreter
[23:44] <icecreamcohen> then the locale will be local to the interpreter (PySystemState) and you???re good.
[23:45] <tactevo> jimbaker, ahh bash.. what would we do without it ? lol.. Hey, I just made a quick jython function to update the java.library.path dynamically. it works! In case anyone else ever needs it:
[23:45] <tactevo> def set_java_library_path(path):
[23:45] <tactevo> java.lang.System.setProperty('java.library.path', path)
[23:45] <tactevo> sys_paths_field = java.lang.ClassLoader.getDeclaredField("sys_paths")
[23:45] <tactevo> sys_paths_field.setAccessible(True)
[23:45] <tactevo> sys_paths_field.set(None, None)
[23:45] * mbooth (~mbooth@redhat/mbooth) Quit (Ping timeout: 245 seconds)
[23:45] <jimbaker> yeah. this is why we have that threadLocalStateInterpreter to build such things...
[23:45] <icecreamcohen> oh, I didn???t know about that.
[23:45] <icecreamcohen> the docs are??? hard to find.
[23:46] <jimbaker> tactevo, i seriously have wanted to switch to using (c)python to launch jython, but i'm occasionally reminded that it's not always available
[23:46] <jimbaker> icecreamcohen, yeah, sorry about that!
[23:46] <icecreamcohen> is this new in 2.7?
[23:46] <jimbaker> jythonbook.com is not bad, but it doesn't get into some of the more advanced topics
[23:46] <icecreamcohen> I *think* I???m still on 2.5. I tried updating and you guys removed the compilation ant task.
[23:48] <jimbaker> icecreamcohen, i'm pretty sure threadLocalStateInterpreter was part of 2.5.x at some point, so as to support JSR-223
[23:49] <icecreamcohen> jimbaker *thank you*
[23:50] <icecreamcohen> and the dict is a local state?
[23:50] <jimbaker> icecreamcohen, no worries - this is a good place to ask these sorts of questions
[23:50] <icecreamcohen> sorry, dict is globals?
[23:50] <icecreamcohen> admittedly, this is pretty low-level.
[23:51] <icecreamcohen> plus, the docs seem to be more around not embedding jython.
[23:51] <jimbaker> yes, it takes globals for that factory
[23:52] <icecreamcohen> I think that this is just about perfect for my usage.
[23:52] <jimbaker> icecreamcohen, yeah, i think this hasn't been the highest priority in documenting, even though it's often the most fun
[23:52] <icecreamcohen> Honestly, I embedded jython to spare my colleagues the pain of java development.
[23:52] <jimbaker> especially since one can build these sorts of objects from python itself
[23:53] <jimbaker> true "snake eating its tail"
[23:53] * AndyBotwin (~botwin@unaffiliated/andybotwin) Quit (Quit: Leaving)
[23:53] <icecreamcohen> right
[23:54] <jimbaker> icecreamcohen, my somewhat neglected project of clamp uses this sort of functionality as well, so once can directly import python code into java projects
[23:54] <jimbaker> one
[23:54] <jimbaker> (i plan to work on clamp again once 2.7 is out...)
[23:54] <icecreamcohen> why did you guys remove the ant compile task?
[23:55] <icecreamcohen> (I figured I???d ask while I???m here)
[23:55] <jimbaker> https://github.com/jimbaker/clamped
[23:55] <jimbaker> icecreamcohen, right you mentioned that - i'm not certain what you mean
[23:55] <icecreamcohen> jimbaker: that???s cool.
[23:55] <jimbaker> i know we require a fairly recent ant
[23:56] <icecreamcohen> you had this class in 2.5: org.python.util.JycompileAntTask
[23:56] <icecreamcohen> I think it was removed in 2.7
[23:56] <icecreamcohen> actually, I???m using 2.7-b2
[23:56] <icecreamcohen> it was removed in a later release.
[23:57] * mbooth (~mbooth@cpc68386-shef10-2-0-cust10.17-1.cable.virginm.net) has joined #jython
[23:57] * mbooth (~mbooth@cpc68386-shef10-2-0-cust10.17-1.cable.virginm.net) Quit (Changing host)
[23:57] * mbooth (~mbooth@redhat/mbooth) has joined #jython
[23:58] <jimbaker> icecreamcohen, i still see it in the repo...
[23:58] <icecreamcohen> hmm??? let me see.
[23:58] <icecreamcohen> I sound like a total idiot.
[23:58] <jimbaker> icecreamcohen, np - but i would definitely use what's in trunk if possible
[23:58] <jimbaker> if only because i want to get this damn thing out ;)
[23:58] <icecreamcohen> do you have a maven build?
[23:59] <jimbaker> and more people using it...
[23:59] <jimbaker> icecreamcohen, sadly no - there's a bug for that. but it's not going to happen for 2.7.0
[23:59] <icecreamcohen> the heck? Where am I getting this build from then?


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