#jython IRC Log (v0.9)

Index

IRC Log for 2015-11-21

Timestamps are in GMT/BST.

[0:00] <Cheaterman> hmm
[0:00] <Cheaterman> I'll try setting -classpath before the -X thingies for the RAM because right now it dooesn't workie, agronholm
[0:00] <Cheaterman> or maybe I should use the env var rather
[0:00] <Cheaterman> I'll do that
[0:01] <agronholm> and if minecraft's launcher replaces it?
[0:01] <Cheaterman> It's a server side plugin, there's no launcher
[0:01] <agronholm> the server isn't launched? :)
[0:01] <Cheaterman> I mean, if they want to reset classpath from inside the app, they can do it anyways right
[0:01] <Cheaterman> no matter how I set it
[0:02] <Cheaterman> well, per-se, what launches my server is my jre ^^"
[0:04] <Cheaterman> agronholm: no more luck
[0:04] <Cheaterman> so, I suppose Minecraft decided I can't set its classpath
[0:04] <Cheaterman> how can I cheat my way out of this? :-)
[0:04] <agronholm> append to sys.path
[0:04] <Cheaterman> can do
[0:08] * verterok (~ggonzalez@156.35.213.162.lcy-02.canonistack.canonical.com) Quit (Ping timeout: 240 seconds)
[0:08] <Cheaterman> agronholm: same thing
[0:09] * verterok (~ggonzalez@156.35.213.162.lcy-02.canonistack.canonical.com) has joined #jython
[0:09] <agronholm> I'm not seeing something then
[0:09] <agronholm> try to do this with the standalone jython without minecraft
[0:09] <Cheaterman> Okay
[0:13] <Cheaterman> agronholm: same thing
[0:13] <Cheaterman> so.
[0:14] <Cheaterman> env CLASSPATH='./*' java -jar jython.jar
[0:14] <Cheaterman> that's how I opened the interpreter
[0:14] <Cheaterman> >>> os.environ['CLASSPATH']
[0:14] <Cheaterman> returns ./* properly
[0:14] <agronholm> try putting sqlalchemy.jar directly on the class path
[0:14] <Cheaterman> cachedir jython.jar sqlalchemy.jar
[0:14] <Cheaterman> Okay
[0:15] <Cheaterman> afterwards I'll try a full absolute path again
[0:16] <agronholm> iirc java does not even have a concept of "current directory"
[0:16] <Cheaterman> Good to know
[0:17] <Cheaterman> Nonetheless, doesn't work :-///
[0:17] <Cheaterman> env CLASSPATH="$(pwd)/sqlalchemy.jar" java -jar jython.jar
[0:17] <agronholm> could you send me that sqlalchemy.jar?
[0:17] <agronholm> I'll try it here
[0:17] <Cheaterman> thanks buddi
[0:18] <Cheaterman> https://transfer.sh/67u0v/sqlalchemy.jar
[0:20] <Cheaterman> agronholm: my pinky finger tells me we're gonna be the first to boast about using sqlalchemy in a minecraft server plugin
[0:20] <Cheaterman> \o/
[0:20] <agronholm> Cheaterman: putting it to CLASSPATH didn't work but adding it to sys.path did
[0:20] <agronholm> I have another trick up my sleeve though
[0:21] <agronholm> run "jython -m compileall sqlalchemy" in site-packages and then repackage the jar
[0:21] <agronholm> CLASSPATH should work then
[0:21] <Cheaterman> Hmm
[0:21] <Cheaterman> Do I still have to remove the classes
[0:22] <agronholm> no, specifically not
[0:22] <agronholm> in fact you could remove the .py files instead
[0:22] <Cheaterman> hehehe
[0:22] <agronholm> but you should be aware that the generated class files are bound to a particular jython version
[0:22] <Cheaterman> honestly, the less I upgrade the better I am, but I'll keep this in mind
[0:22] <Cheaterman> weirdly enough agronholm adding to sys.path doesn't make it here
[0:22] <Cheaterman> oh
[0:23] <Cheaterman> agronholm: you meant from inside interpreter
[0:23] <agronholm> yes
[0:23] <Cheaterman> I added to env PATH
[0:23] <agronholm> that's not sys.path
[0:23] <Cheaterman> ah!
[0:23] <Cheaterman> didn't realize
[0:23] <agronholm> if anything, it's JYTHONPATH
[0:23] <Cheaterman> Okay
[0:23] <agronholm> you can set JYTHONPATH to get the same effect
[0:23] <Cheaterman> Good to know, it's easier for me this way
[0:23] <Cheaterman> Should I do that or the compile all option?
[0:24] <agronholm> the compileall thing has an advantage of not having to compile to .class files at runtime so startup is faster
[0:24] <Cheaterman> That's actually a very good point, because my plugin already takes ages to load, and it's only a few lines
[0:25] <Cheaterman> can I actually compile my plugin too
[0:25] <Cheaterman> with the same command
[0:25] <agronholm> yes
[0:25] <Cheaterman> awesome, I'll have to give it a shot
[0:26] <Cheaterman> combining the best of both worlds :) fast startup of compiled languages, RAD and general awesomeness of python
[0:31] <Cheaterman> well jython itself does still take ages to load hehe
[0:32] <Cheaterman> apparently ./Lib is a valid CLASSPATH
[0:33] <Cheaterman> Okay agronholm my jar is technically in my sys.path
[0:33] <Cheaterman> and I still can't import sqlalchemy
[0:33] <agronholm> did you try the same with just the standalone?
[0:33] <Cheaterman> this is the standalone
[0:34] <agronholm> so what exactly did you do?
[0:34] <Cheaterman> so
[0:34] <Cheaterman> I compiled my package
[0:34] <Cheaterman> put it in the same dir, set classpath, tried
[0:34] <Cheaterman> failed
[0:34] <Cheaterman> imported sys, loooked at sys.path
[0:34] <Cheaterman> ['', '/home/minecraft/lib/Lib', '/home/minecraft/lib/jython.jar/Lib', '__classpath__', '__pyclasspath__/']
[0:34] <Cheaterman> then I was like "well I can live with a Lib/ subdir"
[0:34] <Cheaterman> moved my sqlalchemy.jar in there
[0:35] <Cheaterman> tried again
[0:35] <Cheaterman> fail.
[0:35] <agronholm> the jar needs to be explicitly added to sys.path or it won't work
[0:35] <Cheaterman> oh
[0:35] <agronholm> unlike with CLASSPATH
[0:35] <Cheaterman> CLASSPATH didn't work either though
[0:36] <agronholm> well, explicitly adding the jar to sys.path via append() or setting JYTHONPATH should work
[0:36] <agronholm> maybe you are starting to understand why I'm looking at moving my app from jython to kivy :)
[0:36] <Cheaterman> :3333
[0:37] <Cheaterman> looks like a PITA, I can assure you that packaging with Kivy or even getting started is less work than this
[0:37] <agronholm> java's class loaders are enough of a PITA by themselves, but adding jython to the mix? ouch.
[0:38] <Cheaterman> explicitly adding to sys.path seems to work
[0:38] <Cheaterman> what an adventure lol
[0:38] <Cheaterman> seems to work ??? got my interpreter to freeze lock when importing
[0:38] <Cheaterman> probably means there was still something to compile after all
[0:38] <agronholm> not necessarily
[0:38] <Cheaterman> (or I should have removed the .py files? shouldn't it prefer class files?)
[0:38] <Cheaterman> ah
[0:38] <agronholm> importing is slow, even if they're compiled
[0:38] <Cheaterman> Okay
[0:39] <Cheaterman> good
[0:39] <Cheaterman> seems to have worked
[0:39] <Cheaterman> yay
[0:39] <agronholm> good for you :)
[0:39] <Cheaterman> So now all I need to do is edit my actual plugin code to edit sys.path and I should be good \o/
[0:39] <Cheaterman> Thanks a lot agronholm as usual!!! you helped me alot bliblibli
[0:40] <agronholm> yw :)
[0:44] <Cheaterman> Received my new VPS \o/ it's gonna be faster now
[0:44] <Cheaterman> Thanks ImportError: No module named MySQLdb
[0:45] <Cheaterman> agronholm: ???
[0:45] <Cheaterman> was about to thank you but actually I have a last issue hehe
[0:45] <Cheaterman> (well, hopefully last)
[0:46] <agronholm> mysqldb won't work with jython
[0:46] <Cheaterman> oh so i can't use mysql
[0:46] <agronholm> you have two choices here: a pure python mysql driver or use zxjdbc with the java mysql driver
[0:47] <Cheaterman> which would be easier to set up in my situation?
[0:47] <agronholm> probably the former
[0:47] <Cheaterman> alrighty bliblibli
[0:47] <agronholm> suggest you look at the sqlalchemy mysql section for more info on driver alternatives
[0:47] <Cheaterman> thanks buddi, that's what i was looking for :)
[0:48] <Cheaterman> http://docs.sqlalchemy.org/en/latest/dialects/mysql.html
[0:48] <Cheaterman> So.
[0:48] <Cheaterman> If everything goes right, I simply need to add +pymysql to my DSN?
[0:49] <agronholm> yes
[0:49] <agronholm> you may need to tweak any options if you have some specified
[0:50] <Cheaterman> All defaults here :)
[0:51] <agronholm> so you don't even set the character set to utf-8?
[0:51] <agronholm> mysqldb defaults to latin-1
[0:51] <Cheaterman> not manually, but my default db collation is unicode
[0:51] <Cheaterman> ah
[0:51] <agronholm> db collation != client character set
[0:51] <Cheaterman> True, but my client should be able to query that
[0:52] <agronholm> yes, and it will then mangle unencodeable characters :(
[0:52] <Cheaterman> err good point
[0:52] <Cheaterman> I suppose I have to install pymysql and compile and package in the same way
[0:52] <agronholm> yup
[0:53] <Cheaterman> all of this helps me remember why I love python so much
[0:53] <agronholm> you _can_ put them all in a single jar, but I find it easier to manage individual distributions this way
[0:53] <Cheaterman> there's a single distribution here and it's easier to override sys.path once, so I'll try to put them all in a single jar if it shouldn't cause issues
[0:55] <Cheaterman> aight let's try again
[0:55] <Cheaterman> more whisky, too, because it's a long night :)
[0:56] <Cheaterman> life is so much easier without Java hahaha, I sympathize with your pain
[0:57] <agronholm> it's not all bad though
[0:58] <Cheaterman> so clooooooooooooooose
[0:58] <agronholm> jython + java web start lets me deploy desktop apps on all platforms with relative ease
[0:58] <agronholm> and java has really good UI tooling
[0:58] <Cheaterman> AttributeError: 'javapackage' object has no attribute 'RawIOBase'
[0:58] <agronholm> where does that come from
[0:58] <Cheaterman> agronholm: You'll probably say otherwise after working a while with Kivy :-)
[0:59] <Cheaterman> (been doing Java UI myself too, with Swing IIRC?)
[0:59] <Cheaterman> agronholm: my code \o/ because it reaches it
[0:59] <agronholm> Cheaterman: likely not -- IIRC kivy lacks some of the really basic components like foldable trees and dynamically rendering tables
[0:59] <Cheaterman> File "/home/minecraft/plugins/tms.py.dir/model/db.py", line 7, in __init__
[0:59] <Cheaterman> self.engine = engine = create_engine(address, echo=debug)
[0:59] <agronholm> something that come out of the box with swing
[1:00] <agronholm> what code accesses "javapackage"?
[1:00] <Cheaterman> It's just abstractions that are easy enough to code that we don't bother making a generic version, because everyone needs "this" and "that" from it
[1:00] <agronholm> pastebin the full traceback please
[1:00] <Cheaterman> agronholm: I wish I had any idea
[1:00] <Cheaterman> yes
[1:02] <agronholm> none of that library code should be touching any java packages
[1:02] <agronholm> so I'm wondering where that's coming from
[1:03] <Cheaterman> http://paste.pound-python.org/show/s3jmB86Vu4FuAnCqz0N9/
[1:04] <Cheaterman> agronholm: ??? it's not perfect but it should be informative
[1:04] <Cheaterman> tell me fi you need more of the below
[1:04] <agronholm> ok so pymysql/_socketio.py line 16
[1:04] <agronholm> see what's there
[1:05] <Cheaterman> lol
[1:05] <Cheaterman> sounds like shadowing
[1:06] <Cheaterman> class SocketIO(io.RawIOBase):
[1:06] <Cheaterman> that's line 16
[1:06] <Cheaterman> import io
[1:06] <Cheaterman> that's the import
[1:06] <Cheaterman> should I use from io import RawIOBase, or will that still be resoved to java somehow
[1:09] <agronholm> ah, I think the "io" package was implemented in Java in Jython
[1:09] <agronholm> hence "javapackage"
[1:09] <agronholm> but RawIOBase is present in Jython
[1:11] <Cheaterman> Hmm
[1:13] <agronholm> http://paste.pound-python.org/show/dSOk6gJZaP57TrLoaTUn/
[1:19] <agronholm> Cheaterman: could you try that with the standalone?
[2:18] * ztane_ (ztane@lakka.kapsi.fi) has joined #jython
[2:18] * zesus_ (zesus@peruna.fi) has joined #jython
[2:19] * ebarrett_ (~edd@vext01.default.vext01.uk0.bigv.io) has joined #jython
[2:19] * zesus (zesus@peruna.fi) Quit (Write error: Broken pipe)
[2:19] * ebarrett (~edd@vext01.default.vext01.uk0.bigv.io) Quit (Write error: Broken pipe)
[2:19] * ztane (ztane@lakka.kapsi.fi) Quit (Write error: Broken pipe)
[5:56] * cyraxjoe_ (~joe@CableLink205-241.telefonia.InterCable.net) has joined #jython
[5:57] * cyraxjoe (~joe@CableLink205-241.telefonia.InterCable.net) Quit (Ping timeout: 276 seconds)
[8:39] * lac (~quassel@c-ecc4e055.1321-1-64736c11.cust.bredbandsbolaget.se) Quit (Ping timeout: 240 seconds)
[8:40] * lac (~quassel@c-ecc4e055.1321-1-64736c11.cust.bredbandsbolaget.se) has joined #jython
[9:34] * s4ke (~s4ke@p57A52F60.dip0.t-ipconnect.de) has joined #jython
[10:30] <Cheaterman> agronholm: Will do, thanks again, sorry I went to sleepisleepi
[10:40] <s4ke> hi, how is the python 3 support going for jython? is this planned?
[10:44] <agronholm> s4ke: work has started but it's stalled atm
[10:45] <s4ke> ok. thanks for the info
[10:45] <s4ke> was just wondering. have seen jython being around for some time
[10:45] <s4ke> are there any big examples of people using jythong?
[10:45] <s4ke> jython?
[10:46] <agronholm> people don't really call us to tell how they use jython
[10:46] <agronholm> I am personally using it to power a client for the ERP software I wrote
[10:47] <s4ke> agronholm: ok. i am just evaluating some languages for my use cases
[10:48] <agronholm> what use cases?
[10:48] <s4ke> enterprise systems mostly.
[10:50] <agronholm> jython isn't a language per se
[10:50] <agronholm> so if you want to use python, you should probably use cpython 3.5
[10:51] <s4ke> as of now i can see a good use case for scripts in testing
[10:52] <agronholm> do you need java integration there?
[10:52] <s4ke> well testing java applications that is to some extent, but i guess that's a bit so so as native java can do that pretty easy as well
[10:52] <s4ke> i like the idea of python on the JVM though
[10:54] <agronholm> it's not very fast and there are various pitfalls
[10:54] <agronholm> but if you do need tight java integration then there are no other options really
[10:55] <s4ke> ok. thx
[11:01] * s4ke (~s4ke@p57A52F60.dip0.t-ipconnect.de) has left #jython
[14:08] * AndyBotwin (~django@unaffiliated/andybotwin) has joined #jython
[15:28] * AndyBotwin (~django@unaffiliated/andybotwin) Quit (Ping timeout: 265 seconds)
[15:31] * AndyBotwin (~django@unaffiliated/andybotwin) has joined #jython
[15:45] * Cheaterman (~cheaterma@unaffiliated/cheaterman) Quit (Quit: leaving)
[16:06] * Cheaterman (~cheaterma@unaffiliated/cheaterman) has joined #jython
[16:06] <Cheaterman> Owiii ^__^
[16:21] * Cheaterman (~cheaterma@unaffiliated/cheaterman) Quit (Ping timeout: 246 seconds)
[16:31] * Cheaterman (~cheaterma@unaffiliated/cheaterman) has joined #jython
[16:45] * lac is now known as lac_
[16:46] * lac_ is now known as lac
[17:32] * AndyBotwin (~django@unaffiliated/andybotwin) Quit (Quit: Leaving)
[17:45] * maxpowa (maxpowa@ipv6.everythingisawesome.us) Quit (Ping timeout: 240 seconds)
[17:51] * maxpowa (maxpowa@ipv6.everythingisawesome.us) has joined #jython
[18:20] <Cheaterman> Owiiiiiiiii
[18:20] <Cheaterman> let's try to make sqlalchemy work again
[18:21] <Cheaterman> sooo
[18:31] <Cheaterman> agronholm: Okay, it works with standalone
[18:32] <Cheaterman> I don't have the RawIO error
[18:36] <Cheaterman> I changed the import
[18:36] * cyraxjoe_ (~joe@CableLink205-241.telefonia.InterCable.net) Quit (Read error: Connection reset by peer)
[18:36] <Cheaterman> from import io
[18:36] <Cheaterman> to "from io import RawIOBase"
[18:36] <Cheaterman> Not sure it'll change anything
[18:37] * cyraxjoe (~joe@CableLink205-241.telefonia.InterCable.net) has joined #jython
[20:49] * m01_ (~quassel@2a02:2658:1011:1::2:4044) Quit (Ping timeout: 252 seconds)

Index

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