#jython IRC Log (v0.9)

Index

IRC Log for 2010-05-20

Timestamps are in GMT/BST.

[0:02] * mannaz (~mannaz@chello084113205242.2.14.vie.surfer.at) Quit (Read error: Connection reset by peer)
[0:13] * headius (~headius@216.160.3.79) has joined #jython
[0:14] * headius (~headius@216.160.3.79) Quit (Client Quit)
[0:15] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) Quit (Quit: jabley)
[0:27] * thobe (~Adium@c83-249-235-76.bredband.comhem.se) has joined #jython
[2:04] * grarp (~nparrish@ns1.clustrix.com) has left #jython
[2:20] * thobe (~Adium@c83-249-235-76.bredband.comhem.se) Quit (*.net *.split)
[2:20] * agronholm (agronholm@nblzone-211-17.nblnetworks.fi) Quit (*.net *.split)
[2:20] * maxb (~maxb@jabberwock.vm.bytemark.co.uk) Quit (*.net *.split)
[2:21] * ohumbel (~5390f2dc@gateway/web/freenode/x-rcxheapiwjmckjba) Quit (*.net *.split)
[2:22] * ohumbel (~5390f2dc@gateway/web/freenode/x-rcxheapiwjmckjba) has joined #jython
[2:22] * thobe (~Adium@c83-249-235-76.bredband.comhem.se) has joined #jython
[2:22] * agronholm (agronholm@nblzone-211-17.nblnetworks.fi) has joined #jython
[2:22] * maxb (~maxb@jabberwock.vm.bytemark.co.uk) has joined #jython
[2:35] * ttmrichter (~ttmrichte@111.173.79.26) has joined #jython
[3:01] * lopex (lopex@chello089076044027.chello.pl) Quit ()
[3:07] * skay (~skay@pat1.orbitz.net) Quit (Quit: skay)
[3:54] * sgithens (~sgithens@cpe-173-89-70-33.indy.res.rr.com) has joined #jython
[3:58] * jbrendel_ (~ae8fcb1e@gateway/web/freenode/x-fcynhobwxebprwlg) has joined #jython
[3:58] <jbrendel_> Hello!
[4:00] <jbrendel_> I'm trying to use Python classes from Java. In the Jython book, it talks about how to use PythonInterpreter, then do exec a python import statement, get a PyObject handle, which is then cased to a Java interface, which should be used as base.
[4:01] <jbrendel_> However, today I'm finding that it seems to be sufficient to have a Python object derive from a Java interface/class. If that object is created from within Python and then passed to Java code, the Java code can just use it without problem.
[4:02] <jbrendel_> No need to mess with the PythonInterpreter object.
[4:03] <jbrendel_> What am I missing? What do I get by using PythonInterpreter?
[4:04] <agronholm> umm
[4:05] <agronholm> is the entry point to your application a python script?
[4:05] <agronholm> if so, then you already have a PythonInterpreter
[4:06] <agronholm> and yeah, there are two ways of using python classes in java
[4:06] <agronholm> either have the python classes inherit from a java interface, or use the PyObject interface from java
[4:09] <jbrendel_> What is the advantage of the latter, though? It seems to be more involved and less natural. So, I take it that you get something (some advantage) in return?
[4:09] <jbrendel_> And yes, you are right: The entry point is a Python script.
[4:10] <jbrendel_> I guess you have to use PythonInterpreter if you want to create the Python object from within Java, right?
[4:10] <agronholm> the latter means you don't have to create an extra Java interface for every python class
[4:10] <agronholm> jbrendel_, yeah
[4:11] <jbrendel_> Hm. But the Jython book said that if you want to use the Python object like a Java object in your Java code then you'd have to have a Java base interface or class still.
[4:12] <jbrendel_> Even if you use PythonInterpreter. So, you still end up with an extra Java interface for each class.
[4:12] <agronholm> wrong
[4:12] <agronholm> you can invoke methods on PyObject freely, but it's done in a rather explicit manner
[4:12] <agronholm> so PyObjects can't masquerade as natural java objects
[4:13] <jbrendel_> Yes, ok.
[4:13] <jbrendel_> I think that's what the Java base interface/class was about: So you have a very natural Java way (type safe and all) to interact with the Python object.
[4:13] <agronholm> yeah, basically
[4:14] <jbrendel_> Ok. So, basically, as long as Python code produces the object in question, I don't have to deal with PythonInterpreter. And the Java code can simply use the Python object, as long as that object was derived from a Java interface or class.
[4:15] <jbrendel_> The PythonInterpreter is only used if you want to create the object from within Java, so it gives you some 'Python code' to create the object.
[4:15] <jbrendel_> I hope that summed it up ok?
[4:16] <agronholm> I suppose so
[4:16] <jbrendel_> Ok. Thank you very much! I appreciate you taking the time to answer my questions.
[4:22] <jbrendel_> #info
[4:23] * jbrendel_ (~ae8fcb1e@gateway/web/freenode/x-fcynhobwxebprwlg) Quit ()
[4:25] * brweber2 (~bweber@ip68-100-65-167.dc.dc.cox.net) has joined #jython
[4:26] * thijstriemstra (~thijstrie@ip545063c5.speed.planet.nl) Quit (Quit: thijstriemstra)
[4:29] * thijstriemstra (~thijstrie@ip545063c5.speed.planet.nl) has joined #jython
[5:03] * sgithens (~sgithens@cpe-173-89-70-33.indy.res.rr.com) Quit (Quit: Leaving)
[5:57] * Disconnected.
[05:31] == juneau001 [~juneau@pool-72-69-84-47.chi01.dsl-w.verizon.net] has quit [Quit: Take care...]
[05:32] == Ozymandias [tim@dyn128-54-163-108.ucsd.edu] has joined #jython
[05:36] == brweber2 [~bweber@ip68-100-65-167.dc.dc.cox.net] has quit [Quit: brweber2]
[05:37] == JythonLogBot [~PircBot@adsl-178-39-34-243.adslplus.ch] has quit [*.net *.split]
[05:37] == tim_ [tim@dyn128-54-163-108.ucsd.edu] has quit [*.net *.split]
[06:44] == pigletto [~quassel@188.33.222.96] has joined #jython
[06:53] == thobe [~Adium@c83-249-235-76.bredband.comhem.se] has quit [Quit: Leaving.]
[7:30] -anthony.freenode.net- *** Looking up your hostname...
[7:30] -anthony.freenode.net- *** Checking Ident
[7:30] -anthony.freenode.net- *** No Ident response
[7:30] -anthony.freenode.net- *** Found your hostname
[7:31] * JythonLogBot (~PircBot@adsl-178-39-34-243.adslplus.ch) has joined #jython
[7:31] * Topic is 'Jython 2.5.1 final at http://www.jython.org/ | This channel is logged: http://jython.extreme.st/irclogs/ | Please update the wiki: http://wiki.python.org/jython/ | Pastebin: http://pylonshq.com/pasties | IRC Channel: http://wiki.python.org/jython/IrcChannel | Jython Book: http://jythonbook.com | Podcast: http://www.jythonpodcast.com'
[7:31] * Set by pjenvey!~pjenvey@underboss.org on Tue May 04 00:00:54 CEST 2010
[7:59] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) has joined #jython
[8:42] * Oti (~ohumbel@adsl-178-39-34-243.adslplus.ch) Quit (Quit: Oti)
[08:43] == JythonLogBot [~PircBot@adsl-178-39-34-243.adslplus.ch] has quit [Remote host closed the connection]
[09:23] == thobe [~Adium@nat-wireless.itu.dk] has joined #jython
[09:35] == mannaz [~mannaz@78.142.150.242] has joined #jython
[10:06] == hipertracker [~hipertrac@89.167.220.4] has joined #jython
[10:08] == thobe [~Adium@nat-wireless.itu.dk] has quit [Ping timeout: 240 seconds]
[10:09] == thobe [~Adium@nat-wireless.itu.dk] has joined #jython
[10:10] == niallo [~niallo@unworkable-box.ba.kolo.net] has quit [Read error: Operation timed out]
[10:12] == niallo [~niallo@unworkable-box.ba.kolo.net] has joined #jython
[10:22] == thobe [~Adium@nat-wireless.itu.dk] has quit [Ping timeout: 252 seconds]
[10:28] frigg [~frigg@freenode/utility-bot/frigg] requested CTCP VERSION from ohumbel:
[11:48] == jabley [~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com] has quit [Quit: jabley]
[12:15] == thijstriemstra [~thijstrie@ip545063c5.speed.planet.nl] has quit [Quit: thijstriemstra]
[12:20] == thijstriemstra [~thijstrie@ip545063c5.speed.planet.nl] has joined #jython
[12:26] == clajo04_ [~clajo04_@71.167.166.169] has quit [Quit: clajo04_]
[12:28] == jabley [~jabley@87-84-49-84.absolutely2.mezzonet.net] has joined #jython
[12:41] == clajo04_ [~clajo04_@71.167.166.169] has joined #jython
[12:53] == juneau001 [~juneau@FESS-116326.dhcp.fnal.gov] has joined #jython
[13:44] == thijstriemstra [~thijstrie@ip545063c5.speed.planet.nl] has quit [Quit: thijstriemstra]
[13:51] == svenk [~sven@213.73.89.36] has quit [*.net *.split]
[13:51] == mattmtl [~mattmtl@mail.mate1.com] has quit [*.net *.split]
[13:54] == svenk [~sven@213.73.89.36] has joined #jython
[13:54] == mattmtl [~mattmtl@mail.mate1.com] has joined #jython
[14:24] == stakkars [~tismer@82.113.121.32] has quit [Ping timeout: 240 seconds]
[14:34] == pigletto [~quassel@188.33.222.96] has quit [Read error: Connection reset by peer]
[14:47] == goundy [~goundy@143.119-200-80.adsl-dyn.isp.belgacom.be] has joined #jython
[15:25] == juneau001 [~juneau@FESS-116326.dhcp.fnal.gov] has quit [Read error: Connection reset by peer]
[15:26] == juneau001 [~juneau@FESS-116326.dhcp.fnal.gov] has joined #jython
[15:41] == goundy [~goundy@143.119-200-80.adsl-dyn.isp.belgacom.be] has quit [Quit: Ex-Chat]
[15:45] == clajo04_ [~clajo04_@71.167.166.169] has quit [Quit: clajo04_]
[15:50] == clajo04_ [~clajo04_@71.167.166.169] has joined #jython
[15:56] == lheuer [~heuer@unaffiliated/lheuer] has joined #jython
[15:59] == skay [~skay@pat1.orbitz.net] has joined #jython
[16:24] == slackytude [~slacky@g227074224.adsl.alicedsl.de] has joined #jython
[16:24] <slackytude>hello again
[16:24] <slackytude>Im trying to embed a jython script into my java app. I use the factory example from the wiki
[16:25] <slackytude>however I get an exception
[16:25] <slackytude>Exception in thread "MainThread" java.lang.ClassCastException: org.python.core.PySingleton cannot be cast to javapython.EmployeeType
[16:25] <slackytude> at javapython.EmployeeFactory.create(EmployeeFactory.java:26)
[16:25] <slackytude> at javapython.atest.main(atest.java:34)
[16:25] <slackytude>any ideas?
[16:32] == enebo [~enebo@174-20-111-148.mpls.qwest.net] has joined #jython
[16:33] <ohumbel>slackytude: i assume you took the example from http://wiki.python.org/jython/JythonMonthly/Articles/October2006/3
[16:33] <ohumbel>can you pastebin atest.java?
[16:34] <slackytude>correct
[16:34] <slackytude>yes, give me a second
[16:42] <slackytude>http://pastebin.com/a0XRNbWv
[16:44] <slackytude>interface: http://pastebin.com/JSSvTZRU
[16:44] <slackytude>factory: http://pastebin.com/niiyxU4M
[16:45] <slackytude>python class : http://pastebin.com/MeEhj2XP
[16:45] <slackytude>ohumbel, ping
[16:46] <ohumbel>yes, i am reading and thinking - don't see it yet ...
[16:48] <slackytude>if I do a print NFCcom I get
[16:48] <slackytude>
[16:48] <slackytude>I thought that it tried to use the module NFCcom
[16:50] <slackytude>If I change the python class name to SomeThingElse I can't seem to import
[16:51] <slackytude>from driver.NFCcom import SomeThingElse fails
[16:54] <slackytude>ohumbel, nvm
[16:54] <slackytude>ohumbel, I got it
[16:55] <slackytude>ohumbel, thx for your time ^-^
[16:55] <ohumbel>slackytude: np, curious what ist was?
[16:55] <slackytude>meh, because I couldnt bring java to search for the module, I just copied it over to jython/lib for the momen
[16:56] <slackytude>but I did my changes in the original files
[16:56] <slackytude>the copy was using wrong base class
[16:56] <slackytude>In short, I was stupid
[16:57] == cryzed [~cryzed@i59F5D306.versanet.de] has joined #jython
[16:57] <ohumbel>don't say that - but i am glad it worked out well at the end :-)
[16:57] <slackytude>any idea how to search in local folder for modules?
[16:57] <slackytude>yeah, working with jython is nice so far
[16:57] <ohumbel>in jython: sys.path.append()
[16:58] <cryzed>Hey - currently I'm trying to use java.awt.Robot to press some keys. Basic things like, Shift, A, B, C etc. work - but is there a more dynamic way of sending keys? Let's say for example I want to send Umlauts (ä, ü, ..) how would I go about doing that?
[16:58] <slackytude>ohumbel, nice
[16:59] == juneau001 [~juneau@FESS-116326.dhcp.fnal.gov] has quit [Read error: Connection reset by peer]
[17:00] == ttmrichter [~ttmrichte@111.173.79.26] has quit [Ping timeout: 258 seconds]
[17:02] == juneau001 [~juneau@FESS-116326.dhcp.fnal.gov] has joined #jython
[17:07] == clajo04_ [~clajo04_@71.167.166.169] has quit [Quit: clajo04_]
[17:11] == thobe [~Adium@nat-wireless.itu.dk] has joined #jython
[17:12] == thobe [~Adium@nat-wireless.itu.dk] has quit [Client Quit]
[17:32] <slackytude>this function: def setup_com(self): return "False"
[17:32] <slackytude>gives me a null object in java
[17:32] <slackytude>not the string
[17:32] == lheuer [~heuer@unaffiliated/lheuer] has quit [Quit: Closing Time]
[17:39] == whaley [~whaley@c-71-199-235-64.hsd1.fl.comcast.net] has joined #jython
[17:41] <ohumbel>slackytude: i get a string
[17:41] <slackytude>thats bad
[17:42] <slackytude>String bar = foo.setup_comm();
[17:42] <slackytude> System.out.println(bar); ?
[17:45] <slackytude>ohumbel, what do you do?
[17:46] <ohumbel>at the moment console only, but i am writing a short java test
[17:46] <slackytude>hrm
[17:46] <slackytude>somehow everything is null for me
[17:47] == mannaz1 [~mannaz@78.142.150.242] has joined #jython
[17:48] == mannaz [~mannaz@78.142.150.242] has quit [Ping timeout: 264 seconds]
[17:57] == headius [~headius@216-250-163-113.static.iphouse.net] has joined #jython
[18:01] <slackytude>frustrating
[18:03] == enebo [~enebo@174-20-111-148.mpls.qwest.net] has quit [Quit: enebo]
[18:04] <ohumbel>slackytude: here is my example: http://pylonshq.com/pasties/086b415898cffe06930f5fd4e6436600
[18:07] <ohumbel>id *should* be no difference
[18:07] <slackytude>true enough
[18:08] <slackytude>oh well
[18:08] <slackytude>time for a break
[18:09] <ohumbel>i'll try the import of a .py file as well and then have to run - read the logs
[18:09] <slackytude>I shall
[18:09] <slackytude>thx
[18:18] == mannaz1 [~mannaz@78.142.150.242] has quit [Quit: Leaving.]
[18:26] <ohumbel>slackytude: 2nd attempt: http://pylonshq.com/pasties/483bd65f8eb14c33b26ab47e28c139cd
[18:26] <ohumbel>it was easier for me to call the java class from the interactive interpreter, but this should definitively make no difference
[18:27] <ohumbel>logs will be up to date in a few hours
[18:36] <slackytude> I bookmarked that
[18:37] <slackytude>for now, I think Illl try it again with some tests
[18:38] <slackytude>just trying to get integration into java and then add methods on the pythn side until it break
[18:38] <slackytude>s
[18:40] <slackytude>I see you create an instance very soon
[18:44] == mannaz [~mannaz@chello084113205242.2.14.vie.surfer.at] has joined #jython
[18:45] == jabley [~jabley@87-84-49-84.absolutely2.mezzonet.net] has quit [Quit: jabley]
[18:46] <slackytude> still get null
[18:50] == juneau001 [~juneau@FESS-116326.dhcp.fnal.gov] has quit [Read error: Connection reset by peer]
[18:52] == juneau001 [~juneau@FESS-116326.dhcp.fnal.gov] has joined #jython
[18:55] == mannaz [~mannaz@chello084113205242.2.14.vie.surfer.at] has quit [Read error: Connection reset by peer]
[18:59] <slackytude> ohumbel, I get something back now
[18:59] == juneau001 [~juneau@FESS-116326.dhcp.fnal.gov] has quit [Quit: juneau001]
[19:01] <slackytude> and now netbeans crashed
[19:04] == juneau001 [~juneau@FESS-116326.dhcp.fnal.gov] has joined #jython
[19:15] == juneau001 [~juneau@FESS-116326.dhcp.fnal.gov] has quit [Quit: juneau001]
[19:35] -hubbard.freenode.net- *** Looking up your hostname...
[19:35] -hubbard.freenode.net- *** Checking Ident
[19:35] -hubbard.freenode.net- *** No Ident response
[19:35] -hubbard.freenode.net- *** Found your hostname
[19:35] [frigg VERSION]
[19:35] * JythonLogBot (~PircBot@adsl-84-227-219-1.adslplus.ch) has joined #jython
[19:35] * Topic is 'Jython 2.5.1 final at http://www.jython.org/ | This channel is logged: http://jython.extreme.st/irclogs/ | Please update the wiki: http://wiki.python.org/jython/ | Pastebin: http://pylonshq.com/pasties | IRC Channel: http://wiki.python.org/jython/IrcChannel | Jython Book: http://jythonbook.com | Podcast: http://www.jythonpodcast.com'
[19:35] * Set by pjenvey!~pjenvey@underboss.org on Tue May 04 00:00:54 CEST 2010
[19:35] * Oti (~ohumbel@adsl-84-227-219-1.adslplus.ch) has joined #jython
[19:36] * enebo (~enebo@216-250-174-225.static.iphouse.net) has joined #jython
[19:43] <slackytude> ohumbel, it works for me now
[19:43] <slackytude> ohumbel, not sure whats different
[19:44] <slackytude> ohumbel, my original file will return null. the same content in a different file works.
[19:44] <slackytude> ohumbel, either I have some name conflict or some special chars or something
[19:44] <slackytude> ohumbel, but it works
[19:44] * juneau001 (~juneau@FESS-116326.dhcp.fnal.gov) has joined #jython
[19:46] * headius (~headius@216-250-163-113.static.iphouse.net) Quit (Quit: headius)
[19:55] * juneau001 (~juneau@FESS-116326.dhcp.fnal.gov) Quit (Read error: Connection reset by peer)
[19:55] * juneau001 (~juneau@FESS-116326.dhcp.fnal.gov) has joined #jython
[20:16] * thobe (~Adium@c83-249-235-76.bredband.comhem.se) has joined #jython
[20:21] * cryzed (~cryzed@i59F5D306.versanet.de) Quit (Ping timeout: 265 seconds)
[20:23] * hipertracker (~hipertrac@89.167.220.4) Quit (Quit: hipertracker)
[20:25] <Oti> slackytude: good to hear (disguised as ohumbel)
[20:26] <slackytude> ^-^
[20:34] * cryzed (~cryzed@i538731DA.versanet.de) has joined #jython
[20:35] * cryzed (~cryzed@i538731DA.versanet.de) Quit (Client Quit)
[20:35] * thobe (~Adium@c83-249-235-76.bredband.comhem.se) Quit (Ping timeout: 245 seconds)
[20:41] * thobe (~Adium@c83-249-235-76.bredband.comhem.se) has joined #jython
[20:46] * jabley (~jabley@cpc1-farn4-0-0-cust318.glfd.cable.ntl.com) has joined #jython
[20:51] * headius (~headius@216-250-174-225.static.iphouse.net) has joined #jython
[21:19] * juneau001 (~juneau@FESS-116326.dhcp.fnal.gov) Quit (Quit: juneau001)
[21:33] * plankton (~peretto@187-17-17-100.wln.net.br) has joined #jython
[21:51] * plankton (~peretto@187-17-17-100.wln.net.br) Quit ()
[22:10] * stakkars (~tismer@82.113.119.247) has joined #jython
[22:26] * juneau001 (~juneau@pool-72-69-84-47.chi01.dsl-w.verizon.net) has joined #jython
[23:20] * enebo (~enebo@216-250-174-225.static.iphouse.net) Quit (Quit: enebo)
[23:20] * headius (~headius@216-250-174-225.static.iphouse.net) Quit (Quit: headius)
[23:51] * skay (~skay@pat1.orbitz.net) Quit (Quit: skay)
[23:58] * robbyoconnor (~rob@guifications/user/r0bby) 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).