#jython IRC Log (v0.9)


IRC Log for 2010-05-13

Timestamps are in GMT/BST.

[0:03] <dhaza> is there anything better than jythonc to use currently?
[0:04] <grarp> to do what?
[0:04] <dhaza> generate a .class file from python source code
[0:06] <grarp> the preferred method these days is using object factories, see http://jythonpodcast.hostjava.net/jythonbook/en/1.0/JythonAndJavaIntegration.html#using-jython-within-java-applications
[0:07] <grarp> jythonc has been deprecated
[0:07] <dhaza> cool - thanks for the link
[0:07] <dhaza> i've read, but it didnt seem like there was anything to take its place yet
[0:07] <dhaza> or atleast it was still work in progress
[0:22] <sabi> dhaza: that is true.
[0:22] <sabi> i mean, you can generate .class files from python source code now, but they're not standalone
[0:22] <sabi> that's what happens when you import something :)
[0:26] <dhaza> hmm
[0:26] * skay (~skay@pat1.orbitz.net) Quit (Quit: skay)
[0:27] <dhaza> we have a framework which takes a java class extending some abstract class, and then does fancy things with it
[0:27] <dhaza> i would love to be able to just drop in python classes and have it work
[0:28] <dhaza> im thinking either: use jythonc to compile it to a class, and then reference them directly
[0:28] <dhaza> or have a stub class which compiles the python code and forwards any method calls to the appropriate compiled class method
[0:29] <grarp> I think if you follow the one-to-one object factory method and implement those abstract class methods (essentially an interface) then you can do this
[0:29] <grarp> of course you will still need to include the jython.jar stuff
[0:30] <dhaza> grarp, yeah, that is what im leaning towards
[0:30] <grarp> but the nice thing is you can twiddle your python code more or less on the fly during your development, which is the whole reason why I use jython
[0:30] <dhaza> its hard only because im not very familiar with the whole java ecosystem
[0:30] <sabi> yes, indeed, that is kinda the point :)
[0:30] <grarp> dhaza -- you and me both
[0:30] <dhaza> packaging and compiling java is still a quasi black art for me
[0:31] <grarp> I wish there was a document/blog called "java for haters"
[0:31] <dhaza> hah
[0:31] <grarp> which basically explained the least you need to know about java in order to use jython effectively to leverage java classes from within jython
[0:31] <dhaza> that would be awesome
[0:31] <grarp> my main complaint with the jython book is that it appears to be written for java weenies who want to learn python
[0:31] <dhaza> the whole point of me doing this is so i dont need to write java
[0:32] <grarp> rather than for folks who know python and want to use jython in order to interact with the java world without actually turning into java weenies
[0:33] <grarp> dhaza -- my recommendation is to spend a little bit of time getting your head wrapped around the JVM/JRE, particularly the module loading logic (CLASSPATH, etc.)
[0:35] <grarp> it might mean some time spent on sun^H^H^Horacle's website, but at the end of the day it will actually start to make sense
[0:35] <sabi> if you get a chance to write stuff down that helps, there's the jython wiki :)
[0:36] <grarp> I did update that a bit to at least point to the jython book stuff on object factories
[0:36] <grarp> when I first encountered it it still referenced jythonc primarily
[0:38] <dhaza> okay cool
[0:38] <dhaza> thanks for the heads up guys
[0:38] <dhaza> im off to research
[0:38] <dhaza> cheers
[0:39] * dhaza (~dhaza@nyc01.limewire.com) Quit (Quit: Leaving)
[1:02] * dom96 (~dom96@unaffiliated/dom96) has joined #jython
[1:11] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) Quit (Quit: jabley)
[1:13] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) has joined #jython
[1:16] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) Quit (Client Quit)
[1:30] * robbyoconnor (~wakawaka@cpe-24-164-169-240.hvc.res.rr.com) has joined #jython
[1:30] * robbyoconnor (~wakawaka@cpe-24-164-169-240.hvc.res.rr.com) Quit (Changing host)
[1:30] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython
[1:32] * dom96 (~dom96@unaffiliated/dom96) has left #jython
[2:57] * lopex (lopex@chello089076044027.chello.pl) Quit ()
[3:16] * ttmrichter (~ttmrichte@ has joined #jython
[3:18] * whaley is now known as SirLoins
[3:19] * SirLoins is now known as whaley
[3:53] * brweber2 (~bweber@ip68-100-65-167.dc.dc.cox.net) has joined #jython
[4:01] * grarp (~nparrish@ns1.clustrix.com) has left #jython
[4:32] * whaley (~whaley@c-71-199-235-64.hsd1.fl.comcast.net) Quit (Quit: :-x)
[5:27] * juneau001 (~juneau@pool-72-69-84-232.chi01.dsl-w.verizon.net) has left #jython
[6:18] * brweber2 (~bweber@ip68-100-65-167.dc.dc.cox.net) Quit (Quit: brweber2)
[6:20] * stakkars (~tismer@ has joined #jython
[6:31] * tinjaw (~Chaim@rrcs-67-52-232-163.west.biz.rr.com) Quit (Ping timeout: 246 seconds)
[6:32] * tinjaw (~Chaim@rrcs-67-52-232-163.west.biz.rr.com) has joined #jython
[7:14] * pigletto (~quassel@ has joined #jython
[8:30] * enebo (~enebo@ has joined #jython
[8:43] * stakkars (~tismer@ Quit (Quit: stakkars)
[9:02] * enebo (~enebo@ Quit (Quit: enebo)
[10:29] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) has joined #jython
[10:38] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) Quit (Quit: jabley)
[10:47] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) has joined #jython
[10:48] * enebo (~enebo@ has joined #jython
[10:53] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) Quit (Quit: jabley)
[11:28] * jabley (~jabley@87-84-49-84.absolutely2.mezzonet.net) has joined #jython
[11:29] * hipertracker (~hipertrac@ has joined #jython
[11:59] * juneau001_ (~juneau@pool-72-69-217-139.chi01.dsl-w.verizon.net) has joined #jython
[13:24] * jabley (~jabley@87-84-49-84.absolutely2.mezzonet.net) Quit (Quit: jabley)
[14:12] * enebo (~enebo@ Quit (Quit: enebo)
[15:07] * pigletto (~quassel@ Quit (Remote host closed the connection)
[15:14] * jabley (~jabley@87-84-49-84.absolutely2.mezzonet.net) has joined #jython
[15:56] * whaley (~whaley@c-71-199-235-64.hsd1.fl.comcast.net) has joined #jython
[16:08] * stakkars_ (~tismer@ has joined #jython
[16:12] * stakkars_ (~tismer@ Quit (Ping timeout: 265 seconds)
[16:14] * skay (~skay@pat1.orbitz.net) has joined #jython
[16:54] * stakkars (~tismer@ has joined #jython
[17:00] * enebo (~enebo@ has joined #jython
[17:05] * headius (~headius@ has joined #jython
[17:07] * pjenvey (~pjenvey@underboss.org) Quit (Read error: Operation timed out)
[17:07] * pjenvey (~pjenvey@underboss.org) has joined #jython
[17:22] * ttmrichter (~ttmrichte@ Quit (Ping timeout: 260 seconds)
[17:33] * lopex (lopex@chello089076044027.chello.pl) has joined #jython
[17:37] * ttmrichter-mobil (~ttmrichte@ has joined #jython
[17:42] * dhaza (~dhaza@nyc01.limewire.com) has joined #jython
[17:42] <dhaza> can anyone point me to information on how to deal with generics in jython?
[17:43] <dhaza> for example, what the equivalent of this java might be: "class Foo extends Bar<A,B,C...>"
[17:45] * tnicholson (~tnicholso@securabit/listener/tnicholson) has joined #jython
[17:47] <tnicholson> anyone know where I can find a fix for beautifulsoup with jython 2.5.1 on Sun with JVM 1.5?
[17:48] <tnicholson> i get the same error on both Sun and Win TypeError: 'NoneType' object is unsubscriptable
[17:51] <agronholm> dhaza, I don't understand the question
[17:51] <agronholm> python is a dynamic language
[17:51] <agronholm> so there are no type declarations
[17:52] <agronholm> and that includes generics
[17:53] <tnicholson> i get the error when I try to install beautifulsoup. java -jar jython.jar setup.py install
[17:54] <agronholm> no idea what that is about
[17:56] * whaley (~whaley@c-71-199-235-64.hsd1.fl.comcast.net) Quit (Quit: :-x)
[17:57] <dhaza> agronholm, interesting...so, If I am extending a java class which is generic, I just don't include them and it works?
[17:57] <tnicholson> here is the output from the Windows host i'm testing on http://pylonshq.com/pasties/e4f42a0e83ffed184c202b70e49a0fb9
[17:57] <agronholm> dhaza, yeah, generics are just a runtime error preventing measure
[17:57] <agronholm> err
[17:57] <agronholm> *compilation time
[17:57] <dhaza> interesting
[17:57] <agronholm> they don't even exist during runtime
[17:57] <dhaza> okay cool, thank you for the info
[17:57] <agronholm> or even in class files
[17:57] <dhaza> i see...i assumed it was like C++ where one class is generated per specific template
[17:58] <agronholm> no, C++ does not have generics
[17:58] <agronholm> it has templates
[17:58] <agronholm> which is an entirely different thing altogether
[17:58] <agronholm> although the syntax is similar
[17:58] <agronholm> C++ creates a new instance of the code for every combination of templating parameters used
[17:59] <agronholm> an awful solution if you ask me
[17:59] <dhaza> understood
[18:01] * tinjaw_ (~Chaim@rrcs-67-52-232-163.west.biz.rr.com) has joined #jython
[18:02] * tinjaw__ (~Chaim@rrcs-67-52-232-163.west.biz.rr.com) has joined #jython
[18:02] * tinjaw (~Chaim@rrcs-67-52-232-163.west.biz.rr.com) Quit (Ping timeout: 252 seconds)
[18:05] * tinjaw__ (~Chaim@rrcs-67-52-232-163.west.biz.rr.com) Quit (Read error: Connection reset by peer)
[18:05] * headius (~headius@ Quit (Quit: headius)
[18:05] * tinjaw_ (~Chaim@rrcs-67-52-232-163.west.biz.rr.com) Quit (Ping timeout: 260 seconds)
[18:06] * headius (~headius@ has joined #jython
[18:17] * grarp (~nparrish@ns1.clustrix.com) has joined #jython
[18:24] * aspiers (~adam@dsl-217-155-199-114.zen.co.uk) has joined #jython
[18:25] <aspiers> hi all, can anyone explain the purpose of the PyType.class_to_type static Map?
[18:25] * headius (~headius@ Quit (Quit: headius)
[18:25] <aspiers> I'm trying to work around http://bugs.jython.org/issue1522
[18:30] <agronholm> perhaps you should just load the script into memory once
[18:30] <agronholm> and not every time you execute it
[18:43] <aspiers> agronholm: not an option
[19:03] * hipertracker (~hipertrac@ Quit (Quit: hipertracker)
[19:03] * whaley (~whaley@c-71-199-235-64.hsd1.fl.comcast.net) has joined #jython
[19:13] * agronholm_ (demigod@2001:1bc8:102:413a:a1e5:e54:4631:cecd) has joined #jython
[19:16] * agronholm (demigod@2001:1bc8:102:413a:8e4:e2:1ad7:7ef) Quit (Ping timeout: 248 seconds)
[19:19] * FooIsMe (~d@e179053130.adsl.alicedsl.de) has joined #jython
[19:19] <FooIsMe> greetings
[19:20] <FooIsMe> Im trying to convert a python script to run as jython script
[19:21] <FooIsMe> right now Im looking for an easy replacement for the CPython bytearray
[19:21] <FooIsMe> any ideas?
[19:22] <agronholm_> not sure what you mean
[19:22] <agronholm_> are those two matters related?
[19:22] <FooIsMe> well, in cpython 2.6.5 there is the bytearray
[19:22] <FooIsMe> there is none in jython
[19:23] <agronholm_> because the "bytes" type is new to python 2.6
[19:23] <agronholm_> you do have jarray.array('b')
[19:23] <FooIsMe> yes
[19:23] <FooIsMe> but they are signed in java
[19:24] <agronholm_> they're not supposed to be interpreted as numbers
[19:24] <FooIsMe> hrm
[19:24] <FooIsMe> thats true
[19:25] <FooIsMe> but I've got a array like this [0x00,0xff,0x00]
[19:25] <FooIsMe> I will get an overflow when I try to put it into a jarray, jarray.array(,'b')
[19:27] <FooIsMe> It looks wrong to me to convert that 255 to a 127
[19:28] <agronholm_> where have you checked the jython book for any hints?
[19:29] <FooIsMe> I havent yet
[19:30] <agronholm_> do you specifically need jarray support or would the python string type suffice?
[19:31] <agronholm_> (that's what python 2.5 and below use for storing binary data)
[19:32] <FooIsMe> the problem is that the python script will write to some hardware device. Its the userspace part for a device driver. I need to transmit hexdecimal byte sequences
[19:32] <agronholm_> string should do fine
[19:32] <FooIsMe> the bytearray is perfect, because I can simply do a file.write(bytearray)
[19:32] <agronholm_> you can do that with a string as well
[19:32] <FooIsMe> that would be great
[19:33] <agronholm_> python 2.x strings are just plain bytestrings anyway
[19:34] * tnicholson (~tnicholso@securabit/listener/tnicholson) Quit (Quit: tnicholson)
[19:34] <FooIsMe> I'll look into that
[19:35] <FooIsMe> thx
[20:01] * jabley (~jabley@87-84-49-84.absolutely2.mezzonet.net) Quit (Quit: jabley)
[20:21] <FooIsMe> that seems to be working
[20:22] <FooIsMe> looks like I need to switch from FileIO to some java streams tho
[20:40] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) has joined #jython
[20:58] * dhaza (~dhaza@nyc01.limewire.com) Quit (Quit: Leaving)
[21:00] * FooIsMe (~d@e179053130.adsl.alicedsl.de) has left #jython
[21:48] <aspiers> any PyType experts arrived in the last few hours?
[21:48] <agronholm_> no
[21:57] <aspiers> :)
[22:06] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) Quit (Quit: jabley)
[23:35] * projectmoon (~projectmo@c-68-49-168-233.hsd1.va.comcast.net) has joined #jython
[23:35] * projectmoon (~projectmo@c-68-49-168-233.hsd1.va.comcast.net) has left #jython
[23:45] * goundy (~goundy@68.167-201-80.adsl-dyn.isp.belgacom.be) has joined #jython
[23:59] * headius (~headius@ has joined #jython


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