#jython IRC Log (v0.9)

Index

IRC Log for 2013-07-17

Timestamps are in GMT/BST.

[1:06] * purplefox (~purplefox@88-105-145-142.dynamic.dsl.as9105.com) Quit (Ping timeout: 240 seconds)
[1:17] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython
[1:20] * purplefox (~purplefox@88-105-145-142.dynamic.dsl.as9105.com) has joined #jython
[2:10] * lheuer1 (~Adium@blfd-5d82254d.pool.mediaWays.net) has joined #jython
[2:12] * lheuer (~Adium@blfd-5d820ab8.pool.mediaWays.net) Quit (Ping timeout: 248 seconds)
[2:22] * mritz (~textual@108-196-154-226.lightspeed.austtx.sbcglobal.net) has joined #jython
[2:25] * lheuer1 (~Adium@blfd-5d82254d.pool.mediaWays.net) Quit (Quit: Leaving.)
[4:11] * mritz (~textual@108-196-154-226.lightspeed.austtx.sbcglobal.net) Quit ()
[4:12] * verterok (~ggonzalez@91.189.93.48) Quit (Read error: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number)
[4:13] * verterok (~ggonzalez@91.189.93.48) has joined #jython
[5:34] * lheuer (~Adium@blfd-5d82254d.pool.mediaWays.net) has joined #jython
[7:10] * peke_ (peke@kapsi.fi) has joined #jython
[7:15] * peke (peke@kapsi.fi) Quit (*.net *.split)
[8:13] * r0bby (~wakawaka@guifications/user/r0bby) has joined #jython
[8:16] * robbyoconnor (~wakawaka@guifications/user/r0bby) Quit (Ping timeout: 246 seconds)
[8:18] * Arfrever (~Arfrever@apache/committer/Arfrever) Quit (Quit: Ex??re)
[8:44] * Arfrever (~Arfrever@apache/committer/Arfrever) has joined #jython
[9:02] * davide-mint (~davide-mi@host168-190-dynamic.56-82-r.retail.telecomitalia.it) has joined #jython
[9:02] <davide-mint> hello friends!
[9:02] <davide-mint> :)
[9:03] <davide-mint> i have a little problem and i home you can help me
[9:03] <davide-mint> i have to run a phython module on a java application
[9:04] <davide-mint> the python module is this
[9:04] * r0bby is now known as robbyoconnor
[9:04] <davide-mint> http://pastebin.com/y9KCZ1pk
[9:04] <davide-mint> it's a part of pykaraoke software for linux
[9:05] <agronholm> you can't run this on jython
[9:05] <davide-mint> why?
[9:05] <agronholm> unless I'm grossly mistaken
[9:05] <agronholm> it uses pygame, right?
[9:05] <agronholm> does things that need C extensions?
[9:05] <agronholm> or C libs
[9:05] <davide-mint> yes!
[9:06] <davide-mint> i don't know if it need c
[9:06] <davide-mint> now i look
[9:07] <agronholm> it uses midi through pygame, right?
[9:07] <agronholm> I imagine that requires a C extension to work
[9:08] <davide-mint> yes!
[9:08] <agronholm> so it's a no-go on jython
[9:08] <davide-mint> but i need only the part that recognize the lyric on a kar file
[9:08] <davide-mint> not the midi player
[9:08] <agronholm> I see
[9:09] <agronholm> well, then it may or may not work
[9:09] <agronholm> what's the prob you were talking about anyway?
[9:09] <davide-mint> ok...
[9:10] <davide-mint> so i think is better if i rewrite the code in java
[9:10] <agronholm> if you can
[9:12] <davide-mint> i'm writing a simple karaoke player in java
[9:12] <davide-mint> and i have a problem with lyric extraction from kar file
[9:13] <davide-mint> so i have tink to use the pykaraoke library to do it
[9:17] * davide-mint (~davide-mi@host168-190-dynamic.56-82-r.retail.telecomitalia.it) Quit (Remote host closed the connection)
[9:17] <agronholm> seem odd that there is no such thing for java
[9:21] * Guest16119 (~x@93-87-112-9.dynamic.isp.telekom.rs) has joined #jython
[13:12] * gazarsgo (~ralphtice@office.massrel.com) has joined #jython
[13:22] <gazarsgo> i'm trying to repackage something with jython but i can't even get the demo maven jython working ???
[13:45] * gazarsgo (~ralphtice@office.massrel.com) Quit (Quit: gazarsgo)
[13:57] * gazarsgo (~ralphtice@office.massrel.com) has joined #jython
[14:55] * gazarsgo (~ralphtice@office.massrel.com) Quit (Quit: gazarsgo)
[14:56] * gazarsgo (~ralphtice@office.massrel.com) has joined #jython
[15:08] * gazarsgo (~ralphtice@office.massrel.com) Quit (Quit: gazarsgo)
[15:09] * agronholm (~agronholm@2001:1bc8:102:6f29:1a1:ab85:2e68:b5de) Quit (Ping timeout: 264 seconds)
[15:09] * gazarsgo (~ralphtice@office.massrel.com) has joined #jython
[15:13] * agronholm (~agronholm@2001:1bc8:102:6f29:196:beb9:8b0d:115c) has joined #jython
[15:13] * ChanServ sets mode +o agronholm
[15:29] * davide-mint (~davide-mi@host168-190-dynamic.56-82-r.retail.telecomitalia.it) has joined #jython
[15:30] <davide-mint> hello! i'm sorry but this morning my internet connection went down.
[15:31] <davide-mint> so, i had seen that java don't work very well with midi file and i want try to run pykaraoke
[15:31] <davide-mint> with jython
[15:32] <davide-mint> with this cose PythonInterpreter interpreter = new PythonInterpreter();
[15:32] <davide-mint> interpreter.execfile("/home/davide-mint/Documenti/pykaraoke/pykaraoke-0.7.5/pykaraoke.py");
[15:32] <davide-mint> i have an error that say
[15:33] <davide-mint> no module named wxverson
[15:33] <davide-mint> is it possible to import this moudule?
[15:33] <davide-mint> many thanks
[15:43] <agronholm> davide-mint: does that involve wxpython?
[15:43] <agronholm> wxpython does not work on Jython
[15:48] <davide-mint> i think it's necessary for gui
[15:48] <davide-mint> but i don't need it
[15:50] <davide-mint> now i try run the file pykar.py. it's only the midi module of pykaraoke
[15:50] <davide-mint> and i have this error
[15:50] <davide-mint> no module named pykconstants
[15:51] <davide-mint> is it possible to solv?
[15:51] <davide-mint> *solve
[15:51] <davide-mint> i have to improve my english :)
[16:00] <agronholm> put it in your classpath
[16:00] <agronholm> same as with any module
[16:09] <davide-mint> i'm sory but i don't understand well
[16:09] <davide-mint> this is my python file
[16:09] <davide-mint> http://pastebin.com/rUPSdBx7
[16:09] <davide-mint> and this is the java file
[16:09] <davide-mint> http://pastebin.com/pFhJVsTb
[16:09] <davide-mint> is it correct?
[16:09] <agronholm> well everything you import needs to be somewhere where the interpreter can find it
[16:10] <agronholm> if you simply execute something, the interpreter won't know where to find the rest of your program if it consists of several modules
[16:11] <davide-mint> yes, clear
[16:11] <davide-mint> so how can i solve?
[16:11] <davide-mint> actually the python file are in the same folder
[16:11] <davide-mint> and java file in other folder
[16:15] <agronholm> put them into your class path and import the module rather than execute it directly
[16:24] <davide-mint> ok!! it seem to work!
[16:24] <davide-mint> thank!
[16:25] * gazarsgo (~ralphtice@office.massrel.com) Quit (Quit: gazarsgo)
[16:25] <davide-mint> so, now it need pygame.
[16:26] <davide-mint> is it possible to use?
[16:27] * lheuer (~Adium@blfd-5d82254d.pool.mediaWays.net) Quit (Quit: Leaving.)
[16:27] <agronholm> I believe I mentioned that if it uses C extensions, then you can't use it
[16:28] <davide-mint> yes....
[16:28] <davide-mint> so... do you have any suggestion? i have to realize a karaoke player but java don't play all kar and midi file
[16:29] <davide-mint> i think it's a java problem
[16:29] <davide-mint> and i don't know hai i can do
[16:29] <davide-mint> how
[16:35] <agronholm> I can't help you with that, sorry
[16:35] <agronholm> interfacing java and python is not so easy
[16:37] <davide-mint> do not worry. Many thanks for your help
[16:37] <davide-mint> bye!
[16:37] <davide-mint> :)
[16:42] * davide-mint (~davide-mi@host168-190-dynamic.56-82-r.retail.telecomitalia.it) Quit (Ping timeout: 268 seconds)
[16:43] * davide-mint (~davide-mi@host168-190-dynamic.56-82-r.retail.telecomitalia.it) has joined #jython
[16:44] * shashank1 (~shashank@208.91.2.1) Quit (Remote host closed the connection)
[16:45] * davide-mint (~davide-mi@host168-190-dynamic.56-82-r.retail.telecomitalia.it) Quit (Client Quit)
[16:51] * gazarsgo (~ralphtice@office.massrel.com) has joined #jython
[16:55] * lheuer (~Adium@blfd-5d82254d.pool.mediaWays.net) has joined #jython
[18:08] <jimbaker> agronholm, there is this very interesting work to improve jython's support for c extensions, https://www.euroscipy.org/schedule/presentation/13/
[18:08] <jimbaker> wait, that should read
[18:08] <jimbaker> add support for c extensions ;)
[18:10] <jimbaker> agronholm, btw, my proxymaker branch has been working well for me, although i need to add some unit tests to bring it into trunk - see https://github.com/rackerlabs/romper
[19:06] * purplefox (~purplefox@88-105-145-142.dynamic.dsl.as9105.com) Quit (Quit: Leaving)
[20:05] * purplefox (~purplefox@88-105-145-142.dynamic.dsl.as9105.com) has joined #jython
[20:12] * Guest16119 (~x@93-87-112-9.dynamic.isp.telekom.rs) Quit (Read error: Connection reset by peer)
[20:12] * Guest16119 (~x@93-87-112-9.dynamic.isp.telekom.rs) has joined #jython
[20:14] * Guest16119 is now known as bgrz
[20:48] <agronholm> jimbaker: I'm not sure if I've asked this already, but can it produce classes that can be read by java code directly (assuming that the jython runtime is on the class path)?
[20:48] <jimbaker> agronholm, it can
[20:49] <jimbaker> basically the proxy class can be customized as desired
[20:49] <agronholm> well, it is a major milestone then
[20:49] <agronholm> I mean, .class files for actual classes?
[20:49] <jimbaker> agronholm, yes, actual .class files
[20:49] <agronholm> nowadays jython produces .class files out of modules
[20:50] <agronholm> yeah, that's great then
[20:50] <jimbaker> that can be imported by java
[20:50] * purplefox (~purplefox@88-105-145-142.dynamic.dsl.as9105.com) Quit (Ping timeout: 246 seconds)
[20:50] <jimbaker> mind you, the proxymaker stuff only barely scratches this
[20:50] <jimbaker> it just simply opens this functionality up
[20:52] <jimbaker> agronholm, so here's some code using the proxymaker: https://github.com/rackerlabs/romper/blob/master/romper/topology.py
[20:52] <jimbaker> in particular, i wrote this class
[20:52] <jimbaker> https://github.com/rackerlabs/romper/blob/master/clamp/__init__.py
[20:52] <jimbaker> (note all those nice print statements - because it's still a spike!)
[20:53] <jimbaker> agronholm, so i needed to emit a proxy class that had a specific final static defined for serialVersionUID, so the proxy classes could be serialized/deserialized
[20:54] <jimbaker> let me pull up some javap to see what it looks like...
[20:58] <jimbaker> https://gist.github.com/jimbaker/6024424
[20:58] <jimbaker> so the relevant details:
[20:59] <jimbaker> 1. it's named exactly what i want, in this case - otter.excl.plumbing.WordSpout
[20:59] <jimbaker> 2. it has this class signature - public class otter.excl.plumbing.WordSpout extends backtype.storm.topology.base.BaseRichSpout implements org.python.core.PyProxy,org.python.core.ClassDictInit
[21:00] <jimbaker> for java users, this has a no-arg constructor
[21:01] <jimbaker> it also has the necessary support - by implementing org.python.core.PyProxy and org.python.core.ClassDictInit - to readily work as a proxy of java code, so one can go back & forth between python <=> java via the whole threadlocal magic
[21:02] <jimbaker> lastly our type system knows how to work with this, although not flawlessly - still need to fix the outstanding super bug
[21:03] * purplefox (~purplefox@88-105-145-142.dynamic.dsl.as9105.com) has joined #jython
[21:03] <jimbaker> related to this http://bugs.jython.org/issue1540 - there's some confusion here in the bug text because this also happens even with public methods
[21:03] <jimbaker> in terms of getattr failing because it useless recursively calls itself up the wrong path in the hierarchy
[21:07] <jimbaker> now if i wanted to add additional constructors, or support for annotations, this could be readily done, pretty much like what was done in SerializableProxies.doConstants. the interesting challenge will be to make it so you don't need to know asm + our own codegen wrapper of asm to get it done
[21:08] <jimbaker> darjus took a somewhat similar approach in his own java-based clamp; but i think doing it mostly in python is easier to work with
[21:08] <agronholm> that sounds like quite a bit of work
[21:09] <jimbaker> agronholm, i don't expect anyone w/o that sort of expertise to work on something like the clamp part
[21:09] <jimbaker> but take a look at how easy it is to use
[21:09] <jimbaker> one line in the class and it works :)
[21:10] <agronholm> I mean, it sounds like quite a bit of work to implement
[21:10] <agronholm> but you should know best
[21:10] <jimbaker> agronholm, from what i can tell - my proxymaker branch has done all the heavy lifting
[21:11] <agronholm> alright then
[21:11] <jimbaker> because it's only the modification that requires changing jython itself
[21:11] <jimbaker> the proof is in the fact that everything else can be written in pure jython :)
[21:12] <jimbaker> and doConstants which does the serialization magic support for *my* particular case is just this:
[21:12] <jimbaker> def doConstants(self):
[21:13] <jimbaker> self.classfile.addField("serialVersionUID",
[21:13] <jimbaker> CodegenUtils.ci(java.lang.Long.TYPE), Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL)
[21:13] <jimbaker> code = self.classfile.addMethod("<clinit>", ProxyCodeHelpers.makeSig("V"), Modifier.STATIC)
[21:13] <jimbaker> code.visitLdcInsn(java.lang.Long(1))
[21:13] <jimbaker> code.putstatic(self.classfile.name, "serialVersionUID", CodegenUtils.ci(java.lang.Long.TYPE))
[21:13] <jimbaker> code.return_()
[21:13] <jimbaker> (i took some liberty to do a direct code paste??? ;)
[21:13] <jimbaker> yes, that's a bit specialized in terms of the required knowledge??? but it's also super small
[21:14] <agronholm> what the heck does code.visitLdcInsn(java.lang.Long(1)) do?
[21:14] <jimbaker> and also suggests that some helpers could be readily written to support that functionality
[21:14] <jimbaker> agronholm, that's using our internal codegen, which in turn wraps asm
[21:15] <jimbaker> so just to decode the above method: it adds "public static final long serialVersionUID" to the class
[21:15] <jimbaker> and initializes it to the value 1
[21:15] <jimbaker> that may or may not be what you want
[21:15] <jimbaker> for my spike, it certainly is ;)
[21:16] <jimbaker> <clinit> is the class initializer; essentially it's the way to write static { ??? } for the class
[21:17] <jimbaker> now i *don't* want to hardcode any of the above in jython core, so it isn't
[21:19] <jimbaker> agronholm, anyway - if we want to do something similar to add annotation support or what have you, it's about the same level of complexity. i expect the key is to figure out some common uses, then write a nice api to support them. hence our discussion - i hope you can tell me what *you* need
[21:21] <jimbaker> this can then be further wrapped with class decorators or metaclasses
[21:21] <agronholm> well I don't have any upcoming projects where I need this
[21:21] <jimbaker> agronholm, no worries, just keep this in mind
[21:21] <agronholm> sure
[21:25] <jimbaker> so just speculating: it's should be fairly simple to write some sort of import hook that when used, will intercept all imports of java annotations and turn them into class/function decorators
[21:25] <agronholm> yup
[21:25] <jimbaker> which then do the right thing when applied to these proxies
[21:26] <jimbaker> so magic can be made
[21:26] <jimbaker> ;)
[21:26] <agronholm> but that only works if the annotation is directly imported
[21:26] <agronholm> not if the package is imported, or if the annotation is a nested class
[21:28] <agronholm> a safer way might be to introduce a helper class decorator for that
[21:31] <jimbaker> agronholm, yeah - we will figure out specifics
[21:33] <jimbaker> my point is - all of these approaches are compatible w/ my proxymaker branch, which i will soon merge in
[21:34] <jimbaker> (which simply takes the awesome work darjus did and makes it sufficiently flexible)
[21:34] <jimbaker> brb, this cafe has no power :(
[21:35] <jimbaker> need to move elsewhere
[21:43] * thereisnospoon_ (~thereisno@27-33-1-87.tpgi.com.au) Quit (Ping timeout: 245 seconds)
[21:56] * thereisnospoon_ (~thereisno@27-33-1-87.tpgi.com.au) has joined #jython
[22:20] * gazarsgo (~ralphtice@office.massrel.com) Quit (Quit: gazarsgo)
[22:48] * verterok (~ggonzalez@91.189.93.48) Quit (Ping timeout: 240 seconds)
[22:49] * verterok (~ggonzalez@91.189.93.48) has joined #jython
[23:09] * larks (~larks@unaffiliated/larks) Quit (Ping timeout: 245 seconds)
[23:10] * Thev00d00 (~v00d00@gentoo/developer/TheV00d00) Quit (Ping timeout: 246 seconds)
[23:16] * Thev00d00 (~v00d00@pegasus.v00d00.net) has joined #jython
[23:16] * Thev00d00 (~v00d00@pegasus.v00d00.net) Quit (Changing host)
[23:16] * Thev00d00 (~v00d00@gentoo/developer/TheV00d00) 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 (github).