#jython IRC Log (v0.9)


IRC Log for 2010-12-23

Timestamps are in GMT/BST.

[0:17] * bimbo (~emerino@poseidon.etesa.com.mx) has joined #jython
[0:18] <bimbo> hello, is it possible to have some jython scripts in a jar file and load them from there? I've tried adding the directory hierarchy to the classpath but that doesn't work, I've tried it adding a jar containing the directory hierarchy to the CP but still it won't work
[0:19] <bimbo> the only thing that works is adding the dir hierarchy to the python.path, but then when adding the location of a jar file to python.path then it won't work
[0:57] <pr3d4t0r> bimbo: Yes, it's perfectly fine to have the scripts in a .jar file.
[0:57] <pr3d4t0r> bimbo: You can put there .py or .class Python scripts.
[1:04] <bimbo> pr3d4t0r: suppose I have a jar with a single python script: myJAR.jar/mypackage/script.py. How can I use a class defined in script.py? I've tried "from mypackage.script import MyClass" but it always says there's no "script" module
[1:04] <bimbo> under mypackage there's a __init__.py file
[1:05] <pr3d4t0r> bimbo: That ought to work. Are you using -cp ?
[1:05] <pr3d4t0r> bimbo: And, does that work from the command line?
[1:05] <pr3d4t0r> bimbo: I meant, from the file system?
[1:09] <bimbo> pr3d4t0r: yes, it works from the file system, but only when adding the directory to sys.path
[1:10] <bimbo> when using PySystemState#path.add it isn't working
[1:11] <bimbo> I meant python.path not sys.path
[1:11] <pr3d4t0r> bimbo: When you make the .jar, are you sure that your directory structure inside the .jar is /mymodule/script.py ?
[1:11] <pr3d4t0r> bimbo: unzil -l yourfile.jar
[1:11] <pr3d4t0r> bimbo: unzip -l yourfile.jar
[1:12] <bimbo> pr3d4t0r: yes, that's the directory structure shown by the unzip command
[1:13] <pr3d4t0r> bimbo: Are you using the one-bundle jython.jar with everything?
[1:13] <pr3d4t0r> bimbo: How do you run Jython?
[1:14] <bimbo> pr3d4t0r: I'm using the jython.jar bundle in a project, and I'm running Jython using the PythonInterpreter
[1:14] <bimbo> I missed that information, sorry
[1:20] <bimbo> pr3d4t0r: here's the exact error thrown when trying to load the script from the jar: UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 24: ordinal not in range(128)
[1:20] <bimbo> I don't know why, when loading it directly from the file system it does work
[1:21] <pr3d4t0r> bimbo: Did you google that error?
[1:23] <pr3d4t0r> bimbo: Python/Jython thinks that's Unicode instead of UTF-8. Or something.
[1:23] <pr3d4t0r> bimbo: Does your .jar rely on anything other than Python libraries to start? If not, can you post it somewhere where I can download it and give it a run?
[1:24] <pr3d4t0r> bimbo: Or you may email it to eugenex AT cime.net
[1:25] * njoyce (~njoyce@124-171-192-108.dyn.iinet.net.au) Quit (Ping timeout: 260 seconds)
[1:28] <bimbo> pr3d4t0r: I think I've narrowed down the problem, now that I was creating a test case where no Java classes where required by the python script I found out the problem lies in the Java class my python class extends
[1:28] <pr3d4t0r> bimbo: There you go.
[1:29] <pr3d4t0r> bimbo: Was that a JSE or one of your classes, or something else entirely?
[1:29] <pr3d4t0r> bimbo: Er, JSE class
[1:30] * njoyce (~njoyce@124-150-68-113.dyn.iinet.net.au) has joined #jython
[1:31] <bimbo> pr3d4t0r: a custom class, I read here http://mail.python.org/pipermail/python-list/2008-December/1144190.html that I'll need to instruct the interpreter which classloader to use
[1:32] <bimbo> but the example provided is somehow incomplete
[1:32] <bimbo> I think the problem is that the interpreter doesn't know the class the python class is extending
[1:37] * nick (~njoyce@124-171-222-103.dyn.iinet.net.au) has joined #jython
[1:37] * nick is now known as Guest96084
[1:37] <pr3d4t0r> bimbo: Try preloading it using the same class loader. I had a similar issue with Spring + Python.
[1:38] <pr3d4t0r> bimbo: So all I did was preload an instance to force the class loader to get the class, then I could manipulate with ease.
[1:40] * njoyce (~njoyce@124-150-68-113.dyn.iinet.net.au) Quit (Ping timeout: 250 seconds)
[1:40] * Guest96084 is now known as njoyce
[1:49] <bimbo> pr3d4t0r: I guess that didn't work... but still I don't know why it is doing this, the java class it's referencing it's in the classpath, so it shouldn't be a problem
[1:49] <bimbo> also, when loading it from the filesystem that problem doesn't show up
[1:50] <pr3d4t0r> bimbo: Are both the Java class and the Python class in the file system, or is one loaded from .jar and the other from the file system?
[1:51] <pr3d4t0r> bimbo: If the latter, that explains why you don't see the problem ;)
[1:59] <bimbo> pr3d4t0r: the latter, the python script is in a jar file and the java class the python class extends resides in the file system (currently added to the classpath)
[2:02] <bimbo> pr3d4t0r: I've tried using a JSE class, and I'm having the same problem
[2:02] <pr3d4t0r> bimbo: It's going to be your class loaders.
[2:03] <pr3d4t0r> bimbo: Can you load this from the Jython command line interpreter? What happens? Play with that.
[2:03] <bimbo> pr3d4t0r: even if I'm using a JSE class? like java.lang.Object?
[2:04] <bimbo> pr3d4t0r: I've gotta run, I'll play with it from the command line interpreter
[2:05] <bimbo> I've mailed my problem to the jython-users mailing list too, lets hope someone has already been here and knows the answer
[2:05] <bimbo> thank you very very much
[2:05] <bimbo> out!
[2:05] * bimbo (~emerino@poseidon.etesa.com.mx) has left #jython
[2:37] * verterok (~ggonzalez@unaffiliated/verterok) Quit (Quit: leaving)
[2:37] * jbaker (~jimbaker@c-24-8-39-78.hsd1.co.comcast.net) has joined #jython
[3:59] * quizme (~quizme@ has left #jython
[4:14] * verterok (~ggonzalez@ has joined #jython
[4:14] * verterok (~ggonzalez@ Quit (Changing host)
[4:14] * verterok (~ggonzalez@unaffiliated/verterok) has joined #jython
[4:24] * jbaker (~jimbaker@c-24-8-39-78.hsd1.co.comcast.net) Quit (Quit: jbaker)
[4:51] * jbaker (~jimbaker@c-24-8-39-78.hsd1.co.comcast.net) has joined #jython
[4:51] * jbaker (~jimbaker@c-24-8-39-78.hsd1.co.comcast.net) Quit (Read error: Connection reset by peer)
[4:51] * jbaker (~jimbaker@c-24-8-39-78.hsd1.co.comcast.net) has joined #jython
[5:14] * jbaker (~jimbaker@c-24-8-39-78.hsd1.co.comcast.net) Quit (Quit: jbaker)
[6:09] * agronholm (~demigod@nblzone-211-37.nblnetworks.fi) Quit (Quit: KVIrc 4.0.2 Insomnia http://www.kvirc.net/)
[6:10] * agronholm (~demigod@nblzone-211-37.nblnetworks.fi) has joined #jython
[6:50] * robbyoconnor (~wakawaka@guifications/user/r0bby) Quit (Read error: Connection reset by peer)
[6:51] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython
[8:24] * njoyce (~njoyce@124-171-222-103.dyn.iinet.net.au) Quit (Ping timeout: 260 seconds)
[8:32] * jabley (~jabley@5ac7c52e.bb.sky.com) has joined #jython
[8:38] * njoyce (~njoyce@124-171-221-252.dyn.iinet.net.au) has joined #jython
[9:04] * nick (~njoyce@124-149-28-179.dyn.iinet.net.au) has joined #jython
[9:05] * nick is now known as Guest36114
[9:07] * njoyce (~njoyce@124-171-221-252.dyn.iinet.net.au) Quit (Ping timeout: 260 seconds)
[9:09] * jabley (~jabley@5ac7c52e.bb.sky.com) Quit (Quit: jabley)
[9:10] * jabley (~jabley@5ac7c52e.bb.sky.com) has joined #jython
[9:18] * jabley (~jabley@5ac7c52e.bb.sky.com) Quit (Quit: jabley)
[9:32] * jabley (~jabley@5ac7c52e.bb.sky.com) has joined #jython
[10:06] * ohumbel (5390f2dc@gateway/web/freenode/ip. Quit (Ping timeout: 265 seconds)
[10:28] * Guest36114 (~njoyce@124-149-28-179.dyn.iinet.net.au) Quit (Quit: Leaving...)
[10:48] * njoyce (~njoyce@124-149-28-179.dyn.iinet.net.au) has joined #jython
[11:17] * jabley (~jabley@5ac7c52e.bb.sky.com) Quit (Quit: jabley)
[13:36] * jabley (~jabley@5acd7b4f.bb.sky.com) has joined #jython
[14:00] * jabley (~jabley@5acd7b4f.bb.sky.com) Quit (Quit: jabley)
[14:35] * jabley (~jabley@5acd7b4f.bb.sky.com) has joined #jython
[14:35] * jabley (~jabley@5acd7b4f.bb.sky.com) Quit (Client Quit)
[14:36] * jabley (~jabley@5acd7b4f.bb.sky.com) has joined #jython
[15:12] * ohumbel (5390f2dc@gateway/web/freenode/ip. has joined #jython
[15:15] * jabley (~jabley@5acd7b4f.bb.sky.com) Quit (Read error: Connection reset by peer)
[15:15] * jabley (~jabley@5acd7b4f.bb.sky.com) has joined #jython
[15:19] * lopex (lopex@89-76-44-27.dynamic.chello.pl) has joined #jython
[15:20] * njoyce (~njoyce@124-149-28-179.dyn.iinet.net.au) Quit (Ping timeout: 240 seconds)
[15:26] * jabley (~jabley@5acd7b4f.bb.sky.com) Quit (Quit: jabley)
[15:33] * njoyce (~njoyce@124-148-47-143.dyn.iinet.net.au) has joined #jython
[15:50] * enebo (~enebo@184-97-205-152.mpls.qwest.net) has joined #jython
[15:56] * lolsuper_ (~super_@unaffiliated/lolsuper-/x-9881387) has joined #jython
[16:08] * jbaker (~jimbaker@c-24-8-39-78.hsd1.co.comcast.net) has joined #jython
[16:21] * natlus (~simon@transgaming.de) Quit (Ping timeout: 240 seconds)
[16:22] * natlus (~simon@transgaming.de) has joined #jython
[16:22] * njoyce (~njoyce@124-148-47-143.dyn.iinet.net.au) Quit (Ping timeout: 260 seconds)
[16:25] * MarderIII (~marderii@enneman.demon.nl) has joined #jython
[16:50] * Moo-- is now known as XmasMo
[16:50] * XmasMo is now known as XmasMoo
[17:06] * jabley (~jabley@5acd7b4f.bb.sky.com) has joined #jython
[17:50] * jabley (~jabley@5acd7b4f.bb.sky.com) Quit (Quit: jabley)
[18:01] * bimbo (~emerino@poseidon.etesa.com.mx) has joined #jython
[18:14] * fwierzbicki_ (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) Quit (Quit: Ex-Chat)
[18:15] * fwierzbicki (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) has joined #jython
[18:17] * fwierzbicki (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) Quit (Client Quit)
[18:20] * thijstriemstra_ (~thijstrie@i219160.upc-i.chello.nl) has joined #jython
[18:21] * fwierzbicki (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) has joined #jython
[18:23] * thijstriemstra (~thijstrie@i219160.upc-i.chello.nl) Quit (Ping timeout: 240 seconds)
[18:23] * thijstriemstra_ is now known as thijstriemstra
[18:25] * fwierzbicki (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) Quit (Client Quit)
[18:26] * fwierzbicki (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) has joined #jython
[18:35] * thobe (~Adium@h85-8-27-239.dynamic.se.alltele.net) has joined #jython
[18:39] * fwierzbicki (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) Quit (Quit: Ex-Chat)
[18:53] * enebo (~enebo@184-97-205-152.mpls.qwest.net) Quit (Read error: Connection reset by peer)
[18:53] * enebo (~enebo@184-97-205-152.mpls.qwest.net) has joined #jython
[18:55] <bimbo> hello, I'm trying to load a script that resides in a jar file, if the script is pure python it'll load without problems, but if the script uses any java object (even JSE objects, like java.lang.Object) the it'll fail to load the object, throwing an UnicodeException
[18:55] <bimbo> if the script is loaded from the filesystem there's no such error
[19:10] * fwierzbicki (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) has joined #jython
[19:44] * luckman212 (~quassel@pool-96-246-172-198.nwrknj.fios.verizon.net) Quit (Remote host closed the connection)
[19:45] * luckman212 (~quassel@pool-96-246-172-198.nwrknj.fios.verizon.net) has joined #jython
[19:46] * luckman212 (~quassel@pool-96-246-172-198.nwrknj.fios.verizon.net) Quit (Remote host closed the connection)
[20:23] * enebo (~enebo@184-97-205-152.mpls.qwest.net) Quit (Quit: enebo)
[21:07] * njoyce (~njoyce@124-150-98-4.dyn.iinet.net.au) has joined #jython
[21:16] * MarderIII (~marderii@enneman.demon.nl) Quit (Quit: leaving)
[21:17] * thobe (~Adium@h85-8-27-239.dynamic.se.alltele.net) Quit (Ping timeout: 265 seconds)
[21:23] * thobe (~Adium@h85-8-27-239.dynamic.se.alltele.net) has joined #jython
[21:28] * lopex (lopex@89-76-44-27.dynamic.chello.pl) Quit ()
[22:00] * bimbo (~emerino@poseidon.etesa.com.mx) Quit (Remote host closed the connection)
[22:03] * stakkars (~tismer@77-21-85-35-dynip.superkabel.de) Quit (Quit: hasta la vista)
[22:03] * stakkars_ is now known as stakkars
[22:07] * lolsuper_ (~super_@unaffiliated/lolsuper-/x-9881387) Quit (Ping timeout: 245 seconds)
[22:21] * njoyce (~njoyce@124-150-98-4.dyn.iinet.net.au) Quit (Ping timeout: 276 seconds)
[22:24] * verterok (~ggonzalez@unaffiliated/verterok) Quit (Quit: leaving)
[22:25] * verterok (~ggonzalez@unaffiliated/verterok) has joined #jython
[22:33] * njoyce (~njoyce@124-150-81-200.dyn.iinet.net.au) has joined #jython
[22:46] * headius (~headius@ has joined #jython
[22:58] * thobe (~Adium@h85-8-27-239.dynamic.se.alltele.net) Quit (Quit: Leaving.)
[23:25] * headius (~headius@ Quit (Quit: headius)
[23:37] * jabley (~jabley@5ac7c588.bb.sky.com) 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).