#jython IRC Log

Index

IRC Log for 2015-11-22

Timestamps are in GMT/BST.

[0:18] <Cheaterman> http://www.jython.org/javadoc/org/python/core/io/RawIOBase.html
[0:18] <Cheaterman> agronholm: ??? i tried to force importing from this
[0:19] <Cheaterman> from org.python.core.io import RawIOBase
[0:19] <Cheaterman> got other errors now though
[0:21] <agronholm> Cheaterman: are you trying to change the code in those libraries?
[1:11] <Cheaterman> agronholm: No, I changed the code in pymysql
[1:11] <Cheaterman> agronholm: which felt like it was colliding with some java class
[1:11] <Cheaterman> agronholm: since the result changed, I think I was correct
[1:11] <agronholm> what java classes?
[1:11] <Cheaterman> I have no idea
[1:11] <Cheaterman> io ?
[1:12] <Cheaterman> instead of doing from io import RawIOBase I did from org.python.core.io import RawIOBase
[1:12] <Cheaterman> isn't that the same?
[1:12] <agronholm> you shouldn't have to do that
[1:12] <agronholm> under any circumstances
[1:13] <agronholm> I'm not even sure of the semantics of that
[1:13] <Cheaterman> what if minecraft defines an io class
[1:13] <agronholm> you mean a top level package named "io"?
[1:13] <Cheaterman> yeah
[1:13] <agronholm> well you should be able to find out
[1:13] <Cheaterman> it would explain why it works in standalone and not in minecraft
[1:14] <agronholm> get a listing of all minecraft's packages and classes
[1:14] <Cheaterman> I don't know how to do that
[1:14] <Cheaterman> The game is closed source
[1:15] <Cheaterman> I may have a decompiled version available on disk though, one second
[1:15] <agronholm> closed source or not, they still have jars which have classes and packages in them
[1:15] <agronholm> all you have to do is peek inside those jars
[1:17] <Cheaterman> agronholm: import io.netty.util.ReferenceCounted;
[1:17] <Cheaterman> I have such things in java code
[1:17] <Cheaterman> probably means bad things for me right
[1:17] <agronholm> yup
[1:18] <Cheaterman> so I worked around it the way I said above
[1:18] <agronholm> ok, makes sense
[1:18] <Cheaterman> because it "felt" like such collision was happening
[1:18] <Cheaterman> from the error message
[1:18] <Cheaterman> and now I have something different, lemme fire up the game and tell you
[1:19] <agronholm> it's a bit odd though -- python should be preferring python packages to java packages on import
[1:19] <agronholm> *jython should be
[1:19] <agronholm> Cheaterman: ow, wait a minute
[1:19] <agronholm> Cheaterman: what does your sys.path look like?
[1:19] <Cheaterman> http://paste.pound-python.org/show/hZpFwdXxs47Jm2DiKb3r/
[1:19] <Cheaterman> This is the traceback, seems very uninformative
[1:19] <Cheaterman> or maybe it's because the exception is caught?
[1:20] <agronholm> looks that way
[1:20] <agronholm> but paste me your sys.path
[1:20] <Cheaterman> agronholm: sqlalchemy is appended to the sys.path
[1:20] <Cheaterman> not prepended
[1:20] <Cheaterman> because sys.path.append hehe
[1:21] <agronholm> the nearest class loader for jython is jython's own class loader, which should pick up the right "io" class
[1:21] <agronholm> err, package
[1:21] <agronholm> Cheaterman: I don't think it'll help, but you could try prepending the custom jars to sys.path instead of appending
[1:22] <Cheaterman> Yes, that's what I'll do. What's the most pythonic way to do that?
[1:22] <agronholm> sys.path.insert(0, ...)
[1:22] <Cheaterman> Thanks
[1:23] <Cheaterman> I'm constantly out of "permgen" space
[1:23] <agronholm> switch to java 8
[1:24] <Cheaterman> will everything be compatible?
[1:24] <agronholm> hopefully :)
[1:24] <agronholm> java 8 eliminated the special permgen memory area
[1:24] <Cheaterman> oh awesome
[1:24] <Cheaterman> worth a shot then
[1:24] <agronholm> otherwise you can increase the amount of permgen memory
[1:25] <Cheaterman> I put 128m already, it was recommended
[1:25] <agronholm> my jboss installation uses 256
[1:25] <agronholm> otherwise I run into problems constantly
[1:25] <Cheaterman> [02:25:38 INFO]: ['/home/minecraft/lib/Lib', '/home/minecraft/lib/jython.jar/Lib', '__classpath__', '__pyclasspath__/', '/home/minecraft/plugins/tms.py.dir', '/home/minecraft/lib/sqlalchemy.jar']
[1:25] <Cheaterman> finally got your sys.path
[1:26] <Cheaterman> doing the insert now
[1:27] <Cheaterman> I'll use 256 for next load, thanks for the tip agronholm
[1:29] <Cheaterman> [02:29:27 INFO]: ['/home/minecraft/lib/sqlalchemy.jar', '/home/minecraft/lib/Lib', '/home/minecraft/lib/jython.jar/Lib', '__classpath__', '__pyclasspath__/', '/home/minecraft/plugins/tms.py.dir']
[1:29] <Cheaterman> Good
[1:29] <Cheaterman> sqlalchemy is first
[1:29] <agronholm> what's tms.py.dir?
[1:29] <Cheaterman> I'll try to do directly "from io import RawIOBase"
[1:29] <Cheaterman> it's my plugin agronholm
[1:30] <Cheaterman> it's a folder
[1:30] <agronholm> I'd be more comfortable if that too was prepended
[1:30] <Cheaterman> I have no particular control over this
[1:30] <agronholm> ?
[1:30] <Cheaterman> other than I could try to prepend it manually
[1:30] <agronholm> how come
[1:30] <Cheaterman> well I'm not the one who put it there is what I'm saying :)
[1:30] <agronholm> where does it come from?
[1:30] <Cheaterman> pploader I suppose
[1:31] <Cheaterman> which is the Minecraft server plugin that loads jython and my custom python plugins
[1:31] <agronholm> I see
[1:31] <Cheaterman> So now
[1:31] <Cheaterman> I still have the issue
[1:32] <Cheaterman> http://paste.pound-python.org/show/hZpFwdXxs47Jm2DiKb3r/
[1:32] <Cheaterman> look at the second line, I manage to have an exception line 1337
[1:32] <Cheaterman> me so good
[1:32] <Cheaterman> :D
[1:33] <agronholm> you should catch that exception yourself
[1:33] <agronholm> to see what it's about
[1:34] <Cheaterman> That's a good idea
[1:35] <Cheaterman> Aight let's reload the plugin
[1:37] <Cheaterman> Well, it doesn't seem to happen where I think it did
[1:38] <Cheaterman> agronholm: is it possible that it's already caught
[1:38] <Cheaterman> as I already pointed out
[1:39] <agronholm> already caught?
[1:40] <Cheaterman> like by the wrapper
[1:40] <Cheaterman> you put a try block in the __exit__
[1:40] <Cheaterman> would explain why the exception is partly squelched, no?
[1:41] <Cheaterman> I can't seem to be able to catch that exception
[1:42] <Cheaterman> I'm gonna try without the query
[1:42] <Cheaterman> but still using the context manager to get a session
[1:42] <Cheaterman> yay more info
[1:43] <Cheaterman> no exception this time
[1:43] <Cheaterman> so.
[1:43] <Cheaterman> #user = session.query(User).filter_by(name=nick).first()
[1:43] <Cheaterman> anything obviously wrong here to you agronholm ?
[1:43] <agronholm> try block in the exit?
[1:43] <agronholm> but
[1:43] <agronholm> I think you need to elaborate a bt
[1:44] <Cheaterman> on which part
[1:44] <agronholm> on how you're trying to catch the exception
[1:44] <Cheaterman> putting try: except Exception: block around portions of code?
[1:44] <agronholm> what was that about __exit__ then
[1:44] <Cheaterman> context manager?
[1:44] <agronholm> yes
[1:44] <agronholm> show me please
[1:44] <Cheaterman> you gave it to me
[1:45] <agronholm> yes, but how are you catching exceptions there?
[1:45] <agronholm> I mean, if an exception occurred in the underlying code, you can't catch that in __exit__ with a try...except
[1:46] <agronholm> Cheaterman: so just show me what you have please
[1:46] <Cheaterman> yes yes wait a sec
[1:46] <Cheaterman> downloading wgetpate
[1:46] <Cheaterman> paste
[1:46] <Cheaterman> i'm catching exceptions by putting try: except Exception: block around portions of code?
[1:46] <Cheaterman> isn't that how it's supposed to be done?
[1:47] <agronholm> yes...but since you said a context manager is involved, it may not be so simple
[1:47] <agronholm> which is why I want to see what you ahve
[1:47] <Cheaterman> https://github.com/kurtcoke/InstallWgetpaste.git
[1:48] <Cheaterman> See the context manager already has try catch block
[1:48] <agronholm> um why am I looking at wgetpaste's github page?
[1:48] <Cheaterman> sorrii
[1:48] <Cheaterman> http://paste.pound-python.org/show/0ZvXrddwee3RJSCQwjAJ/
[1:49] <Cheaterman> anyways I added except here
[1:49] <Cheaterman> and didn't work
[1:49] <Cheaterman> added in my code around the very same query that makes it fail apparenty
[1:49] <Cheaterman> and it didn't suffice
[1:49] <agronholm> that only catches exceptions occurring in commit()
[1:49] <agronholm> if an exception is raised in the context block, it will be passed to __exit__() as the three arguments
[1:50] <agronholm> and your except: won't catch that
[1:50] <agronholm> had you used the improved version I gave you, that would have caught them too
[1:50] <Cheaterman> http://paste.pound-python.org/show/jeHHDYbJDPWVeKjzneDQ/
[1:50] <Cheaterman> ah good point
[1:51] <agronholm> how do you know the exception isn't coming from code elsewhere, before the with block I mean?
[1:51] <Cheaterman> how is your version any different?
[1:51] <agronholm> I used @contextmanager
[1:51] <Cheaterman> because rest of code is executed
[1:51] <agronholm> instead of a class
[1:51] <agronholm> you don't remember?
[1:51] <Cheaterman> I do
[1:51] <agronholm> it was simpler
[1:51] <Cheaterman> It was a generator
[1:51] <agronholm> yes
[1:51] <Cheaterman> :)
[1:52] <Cheaterman> anyways
[1:52] <agronholm> wrap your whole onJoin() in a try...except block and reraise the exception but not before logging it
[1:52] <Cheaterman> elif exc_type: raise
[1:52] <Cheaterman> should work?
[1:52] <Cheaterman> in the contextmanager
[1:53] <agronholm> that still won't work if the exception is raised outside of the with: block
[1:53] <Cheaterman> and
[1:53] <Cheaterman> logging the exception in onJoin didn't work
[1:53] <Cheaterman> I tried packing the whole with: block
[1:53] <Cheaterman> and logging there, but didn't work
[1:53] <agronholm> where is it importing PythonPlugin from?
[1:53] <Cheaterman> "automagic"
[1:53] <Cheaterman> API convention
[1:54] <Cheaterman> it's just imported before my code, basically
[1:54] <agronholm> if you comment out the entire onJoin, do you still get an exception?
[1:54] <Cheaterman> if I comment the single line that I showed you I stop getting exception
[1:54] <agronholm> oh, line 41?
[1:54] <Cheaterman> yes
[1:55] <Cheaterman> i should really reraise in my context manager right
[1:55] <agronholm> no
[1:55] <Cheaterman> err
[1:55] <Cheaterman> why so
[1:55] <agronholm> by default exceptions are reraised
[1:55] <Cheaterman> they aren't
[1:55] <Cheaterman> traceback would be here
[1:55] <Cheaterman> it's gobbled somehow
[1:55] <Cheaterman> nomnom
[1:55] <agronholm> let me look up the appropriate page from python docs
[1:57] <Cheaterman> The exception passed in should never be reraised explicitly - instead, this method should return a false value to indicate that the method completed successfully and does not want to suppress the raised exception.
[1:57] <Cheaterman> agronholm: ??? you are right
[1:57] <Cheaterman> but then why is my exception swallowed
[1:57] <agronholm> I can't answer that
[1:57] <Cheaterman> hehe
[1:57] <agronholm> but you're saying that logging the error does *nothing*?
[1:57] <Cheaterman> precisely nothing, or I was doing it wrongly
[1:57] <Cheaterman> what I tried was:
[1:58] <Cheaterman> 1??) wrap line 41 in try except Exception as e block
[1:58] <Cheaterman> and inside except was print 'CRASH:', e.strerror
[1:58] <agronholm> e.strerror?
[1:58] <Cheaterman> then I tried wrapping whole with: block in the same try except
[1:58] <Cheaterman> yes, that's the exception full error no?
[1:58] <agronholm> uh, no
[1:58] <agronholm> never seen such a thing
[1:59] <agronholm> maybe you want print str(e)
[1:59] <agronholm> or print e
[1:59] <Cheaterman> in any case, my "crash" thingy wasn't shown
[1:59] <agronholm> maybe because the debugging line itself caused another exception
[2:00] <Cheaterman> good point
[2:00] <Cheaterman> so now
[2:00] <Cheaterman> I did print 'crash', str(e)
[2:00] <Cheaterman> and wrapping line 41 only
[2:00] <Cheaterman> let's see how it goes
[2:00] <Cheaterman> yayy
[2:00] <Cheaterman> [03:00:35 INFO]: CRASH: 'javapackage' object has no attribute 'BufferedReader'
[2:01] <Cheaterman> ??? more collisions, agronholm
[2:01] <Cheaterman> so prepending to sys.path didn't seem to be enough
[2:01] <Cheaterman> which was expected
[2:01] <Cheaterman> because the class in question is python not pymysql or sqlalchemy
[2:01] <Cheaterman> nonetheless a bug right ^^
[2:01] <Cheaterman> now let's see where that buffered reader is
[2:02] <agronholm> you'd have to be able to reproduce this outside of minecraft to be considered an actual jython bug
[2:02] <Cheaterman> agronholm: another one uses import io
[2:02] <Cheaterman> gotta fix that
[2:02] <Cheaterman> Oh
[2:02] <Cheaterman> I never meant it as an actual jython bug, most likely a pploader bug
[2:03] <Cheaterman> because it seems to put my sys.path wrong right?
[2:03] <Cheaterman> i mean my plugin path should be prepended not appended
[2:03] <Cheaterman> anyways i'll be fixing all of the 'import io' statements i can find in pymysql
[2:03] <agronholm> maybe there's another way
[2:04] <agronholm> if you could somehow get a reference to the *real* io module and patch that to sys.modules
[2:04] <Cheaterman> recompiling
[2:04] <agronholm> then you wouldn't have to patch those libraries
[2:04] <Cheaterman> agronholm: honestly i just want the thing to work hehe
[2:05] <agronholm> don't we all
[2:05] <Cheaterman> after two days of struggle, enough of looking for someone to put the blame on, i just wanna monkey patch the whole thing as dirty as i need to in order to make it work
[2:05] <Cheaterman> :D
[2:06] <Cheaterman> and never touch it again, too
[2:06] <Cheaterman> OTOH if you have any idea how I could get such reference, I'll take it
[2:06] <Cheaterman> But honestly, it's two imports to fix in pymysql
[2:06] <Cheaterman> one in connections.py other in _socket.py
[2:07] <agronholm> and god knows how many others
[2:07] <agronholm> ones you haven't run into yet
[2:07] <Cheaterman> what do you mean
[2:07] <Cheaterman> well
[2:07] <Cheaterman> i doubt it but we'll see soon enough
[2:07] <Cheaterman> no more permgen >__> restarting server
[2:07] <Cheaterman> I am at 256 ^^
[2:07] <Cheaterman> I should upgrade to java8 as you said
[2:07] <agronholm> here I'm having fun working with an OpenEdge database from my Python app
[2:08] <agronholm> I hate these proprietary sh*ts
[2:08] <Cheaterman> what is openedge? the erp you were mentioning?
[2:08] <agronholm> openedge is a commercial RDBMS
[2:08] <agronholm> I'm accessing it because I need to integrate our ERP with another one, called "Powered" which runs on top of an OpenEdge (used to be called Progress) db
[2:09] <Cheaterman> you're doing BI
[2:09] <agronholm> I wouldn't go that far
[2:09] <Cheaterman> :DDD
[2:09] <Cheaterman> it does sound like a small case of BI
[2:09] <agronholm> small, okay
[2:09] <agronholm> there's a bit of that, but we're not too deep into it yet
[2:10] <Cheaterman> still, you'll be establishing practices for the future subsidiaries, better get this right to ease maintainance later right
[2:10] <agronholm> yeh...can't wait to migrate this to asphalt
[2:10] <agronholm> it'll be sooo much cleaner
[2:11] <agronholm> not sure you noticed but I recently released the py4j component for asphalt
[2:11] <agronholm> it's a lot of work to get the documentation and examples done right and to keep test coverage at 100%
[2:12] <agronholm> openedge has no official python drivers so I have to use py4j to interface with the JDBC driver
[2:13] <agronholm> but this was easy as pie compared to the previous integration I had to do
[2:13] <Cheaterman> hehehe
[2:13] <Cheaterman> what's py4j exactly
[2:13] <agronholm> it's a library that lets you use java libs directly from CPython
[2:14] <agronholm> almost seamless integration
[2:14] <Cheaterman> interesting, kinda the other way around
[2:14] <Cheaterman> sounds like pyjnius
[2:14] <Cheaterman> we have pyjnius.autoclass('com.google.android.whatever') when we work on android
[2:14] <Cheaterman> when features haven't yet been wrapped
[2:15] <agronholm> I don't imagine that works outside of Android
[2:15] <agronholm> the previously integrated MRP system used an ages old on-disk database which was shared across the network
[2:15] <agronholm> think MS Access
[2:16] <agronholm> it was so old that I had to dig up an old Perl library and reverse engineer it and implement the low level read/write operations and even index writes
[2:16] <agronholm> that took months of work
[2:16] <Cheaterman> agronholm: Hmm
[2:16] <Cheaterman> BytesIO isn't in org.python.core.io
[2:17] <Cheaterman> i'll try importing it in standalone
[2:18] <Cheaterman> but seems like it works for other people with normal io
[2:18] <Cheaterman> just it's not in the docs that i found about org.python.core.io
[2:18] <Cheaterman> and it indeed does not seem to work in minecraft
[2:18] <Cheaterman> importing BytesIO from interactive interpreter works
[2:19] <Cheaterman> now I dunno what to do agronholm seems like we'll have to go the clean way like you suggested initially?
[2:19] <agronholm> the io module is in a .py file
[2:20] <agronholm> wondering if it's possible to just __import__ it somehow
[2:20] <Cheaterman> or prepend to sys.path
[2:20] <agronholm> you can try that
[2:20] <Cheaterman> :q
[2:21] <Cheaterman> ups
[2:22] <Cheaterman> 02:29 < Cheaterman> [02:29:27 INFO]: ['/home/minecraft/lib/sqlalchemy.jar', '/home/minecraft/lib/Lib', '/home/minecraft/lib/jython.jar/Lib', '__classpath__',
[2:22] <Cheaterman> agronholm: what about the second folder
[2:22] <Cheaterman> sys.path[1]
[2:22] <agronholm> what of it?
[2:24] <Cheaterman> if I put io.py inside it, will it work?
[2:24] <Cheaterman> or should I reference it directly?
[2:24] <agronholm> I wonder what happens if you swap the third and second elements on sys.path
[2:24] <agronholm> I don't know
[2:24] <Cheaterman> worth noting second folder does not exist at all
[2:24] <agronholm> then it won't matter
[2:25] <Cheaterman> okay but i could create it
[2:25] <agronholm> to what end?
[2:25] <Cheaterman> and put io.py inside?
[2:25] <agronholm> that won't help
[2:25] <Cheaterman> ok so I'll reference it directly
[2:25] <agronholm> could you check if "io" is already in sys.modules when the plugin is launched?
[2:27] <Cheaterman> most certainly, i'm gonna print sys.modules
[2:27] <agronholm> "'io' in sys.modules" should do the trick
[2:28] <Cheaterman> print 'yay' if 'io' in sys.modules else 'nayy'
[2:32] <Cheaterman> Hmm.
[2:33] <agronholm> well?
[2:33] <Cheaterman> It seems like prepending io.py to sys.path doesn't work
[2:33] <agronholm> what exactly did you do?
[2:33] <Cheaterman> Other than that, working on getting the sys.modules answer
[2:33] <agronholm> putting a .py file directly in sys.path does not work
[2:33] <Cheaterman> I simply referred to the io.py that I have in my full jython distribution
[2:33] <Cheaterman> ah
[2:33] <Cheaterman> I should compile it first?
[2:34] <agronholm> you can try but don't bother trying to add it directly to sys.path
[2:34] <Cheaterman> ['/home/minecraft/spigot/jython/Lib/io.py', '/home/minecraft/lib/sqlalchemy.jar', '/home/minecraft/lib/Lib', '/home/minecraft/lib/jython.jar/Lib', '__classpath__', '__pyclasspath__/', '/home/minecraft/plugins/tms.py.dir']
[2:34] <Cheaterman> That's what I did
[2:34] <agronholm> yeah, don't
[2:34] <Cheaterman> Can I use -mcompileall on a .py file directly?
[2:35] <agronholm> what's wrong with compiling them all?
[2:35] <agronholm> you just have to do it once anyway
[2:35] <Cheaterman> 3:35am
[2:35] <agronholm> it won't take long
[2:35] <Cheaterman> apparently specifying a single file works
[2:35] <agronholm> okay :)
[2:35] <Cheaterman> io$py.class ?
[2:35] <agronholm> yes?
[2:35] <Cheaterman> I put this in sys.path or I make a jar?
[2:35] <agronholm> neither
[2:36] <Cheaterman> :s
[2:36] <Cheaterman> then tell me
[2:36] <agronholm> it might be picked up sooner than the "io" java package
[2:36] <Cheaterman> it's nowhere useful right now tho
[2:36] <agronholm> no?
[2:36] <Cheaterman> I mean it won't be picked up if it can't be found right
[2:36] <Cheaterman> so where do I put it
[2:37] <agronholm> put it in your jython jar
[2:37] <agronholm> in the same directory as the actual .py file
[2:37] <Cheaterman> but wasn't it already
[2:37] <Cheaterman> reminds me
[2:37] <Cheaterman> I could have saved myself the trouble of an extra sqlalchemy.jar
[2:37] <Cheaterman> and packed everything with jython?
[2:38] <agronholm> you _can_, I just like to upgrade the libraries independently
[2:38] <agronholm> hence separate jars
[2:38] <Cheaterman> In my case, it seems to lead to more trouble than help though
[2:38] <Cheaterman> as you could see
[2:38] <Cheaterman> could you remind me how to build the jython.jar file please,
[2:38] <Cheaterman> ?
[2:39] <agronholm> I just thought of one thing
[2:39] <Cheaterman> Because all I did so far was download either the standalone distribution or the other one
[2:39] <Cheaterman> yes?
[2:39] <agronholm> if you set the python.cachedir.skip system property
[2:39] <agronholm> it will prevent you from importing java packages directly
[2:40] <Cheaterman> I don't want that :-(
[2:40] <agronholm> ie. you would have to import classes explicitly
[2:40] <agronholm> why not?
[2:40] <Cheaterman> Because I need Java packages for my plugin I think
[2:40] <agronholm> you can still import _classes_
[2:40] <agronholm> but not packages
[2:40] <Cheaterman> Actually I don't use them anymore, and yes I import classes individually so it should be fine
[2:41] <Cheaterman> so how do I set this magic property? ^_^
[2:41] <agronholm> this has the consequence of not accidentally importing any java packages
[2:41] <agronholm> well there are several ways, the easiest of which is to launch the JVM with -Djython.cachedir.skip=true
[2:41] <Cheaterman> consider it done
[2:42] <agronholm> it's possible that the minecraft launcher has a way to append JVM options
[2:42] <agronholm> just as long as the property is loaded before jython is
[2:42] <agronholm> *property is set
[2:44] <Cheaterman> It doesn't seem to help
[2:44] <agronholm> what happens now if you do "import io"
[2:44] <agronholm> what does it tell you "io" is then?
[2:45] <Cheaterman> http://www.jython.org/javadoc/org/python/core/io/package-summary.html
[2:45] <Cheaterman> Is this documentation uptodate
[2:46] <agronholm> no clue
[2:46] <Cheaterman> okay
[2:46] <Cheaterman> it doesn't have BytesIO which is my issue
[2:46] <Cheaterman> because this was my workaround so far
[2:46] <Cheaterman> anyways
[2:46] <agronholm> but really, if you do print io after importing it, what does it say?
[2:46] <Cheaterman> How should I check for what io is?
[2:46] <Cheaterman> printing it, alrighty
[2:47] <agronholm> this is not showing BytesIO because that comes from io.py
[2:47] <agronholm> this documentation is for the org.python.core.io java package
[2:47] <Cheaterman> it's not the same thing? i don't understand :s
[2:47] <agronholm> io.py imports things from the java package
[2:47] <agronholm> but not everything in there comes from org.python.core.io
[2:47] <Cheaterman> WAAAAAAAAAAAT
[2:47] <Cheaterman> [03:47:33 INFO]: <module 'io' from '/home/minecraft/lib/jython.jar/Lib/io.py'>
[2:47] <agronholm> heh
[2:47] <Cheaterman> That should work
[2:48] <agronholm> well, there you go
[2:48] <Cheaterman> but it does not
[2:48] <agronholm> does not?
[2:48] <Cheaterman> wel
[2:48] <Cheaterman> oh
[2:48] <Cheaterman> >__>
[2:48] <Cheaterman> It's from my plugin
[2:48] <agronholm> what is
[2:48] <Cheaterman> not from the .jar of sqlalchemy/pymysql
[2:48] <Cheaterman> the output you just saw
[2:48] <agronholm> well obviously? it's your module that prints that, yes?
[2:48] <Cheaterman> yes but it's not my module that imports io
[2:49] <Cheaterman> it's pymysql
[2:49] <agronholm> how did you manage "print io" without importing io first?
[2:49] <Cheaterman> I added it
[2:49] <agronholm> but you just said your module doesn't import io...
[2:49] <Cheaterman> initially didn't no
[2:49] <Cheaterman> until you asked me to
[2:49] <Cheaterman> the point is
[2:49] <agronholm> I'm confused now
[2:49] <agronholm> so what's the problem here
[2:49] <Cheaterman> My module isn't in sqlalchemy.jar
[2:49] <agronholm> so?
[2:50] <Cheaterman> so apparently it works for me, who knows if it works for them
[2:50] <agronholm> sys.modules can only refer to one "io" module
[2:50] <agronholm> if your module imports "io" successfully, the others will simply refer to the existing one
[2:51] <Cheaterman> I'll just follow my intuition
[2:51] <Cheaterman> because this sounds so bad
[2:51] <agronholm> why?
[2:51] <Cheaterman> I don't know, gut feeling?
[2:51] <agronholm> when you said it still doesn't work, did that mean it's somehow still importing the java package instead of the python one?
[2:51] <Cheaterman> yes
[2:51] <agronholm> and you verified this?
[2:52] <agronholm> ...it shouldn't even be possible
[2:52] <Cheaterman> there you go
[2:52] <Cheaterman> should python explode if I try to print a javapackage?
[2:52] <agronholm> no
[2:52] <Cheaterman> SyntaxError: ("no viable alternative at input 'io'", ('/home/minecraft/lib/sqlalchemy.jar/pymysql/connections.py', 12, 6, 'print io\n'))
[2:52] <Cheaterman> there's "import io" right above
[2:52] <Cheaterman> ie same code as in my module
[2:52] <Cheaterman> not same result
[2:52] <Cheaterman> good gut feeling :)
[2:52] <Cheaterman> thanks guts :)
[2:53] <agronholm> try print(io)
[2:53] <Cheaterman> Could this have anything to do with the fact that I compile pymysql agronholm
[2:53] <agronholm> no
[2:53] <Cheaterman> ok
[2:53] <agronholm> but really, try print(io) and see what happens
[2:53] <Cheaterman> yes I'm trying
[2:54] <Cheaterman> [03:54:28 INFO]: <java package io 0x28>
[2:54] <Cheaterman> tadam
[2:54] <Cheaterman> good guts!
[2:55] <Cheaterman> told you!
[2:55] <Cheaterman> Do you need me to recap my setup
[2:55] <agronholm> try importing io before importing anything else
[2:55] <agronholm> and verify that it really imports the right thing
[2:55] <Cheaterman> "before anything else" ?
[2:56] <agronholm> before importing sqlalchemy or anything
[2:56] <Cheaterman> it's at the top of the file already
[2:56] <agronholm> in your plugin
[2:56] <Cheaterman> in my plugin it works as we already shown
[2:56] <agronholm> could you pastebin your plugin as it is now
[2:56] <Cheaterman> yes
[2:57] <Cheaterman> http://paste.pound-python.org/show/Seev887prmfFLfXZIHK0/
[2:57] <agronholm> I don't see "import io" anywhere
[2:57] <Cheaterman> Indeed, because I removed it
[2:57] <agronholm> that's precisely the thing I wanted to see :(
[2:58] <Cheaterman> >__>
[2:58] <Cheaterman> I had commented the DB/User import, the whole with block
[2:58] <agronholm> because once you import a module it stays in sys.modules unless explicitly removed
[2:58] <Cheaterman> and I had added "import io; print io" after the commented with block
[2:58] <agronholm> after?
[2:58] <Cheaterman> yes
[2:58] <agronholm> but you told me it was at the top
[2:58] <Cheaterman> it was in onJoin
[2:59] <agronholm> no, you need to import them BEFORE the sqlalchemy stuff!
[2:59] <agronholm> at the top of the module
[2:59] <Cheaterman> it will make sqlalchemy find the good stuff?
[2:59] <agronholm> if indeed it imports the right module, it should stay in sys.modules and thus enable the rest to work correctly
[3:00] <Cheaterman> checking right now
[3:00] <Cheaterman> hehehe
[3:00] <Cheaterman> good job buddi
[3:00] <Cheaterman> now lemme try my query
[3:00] <Cheaterman> YAYYYY
[3:00] <Cheaterman> magic
[3:00] <Cheaterman> \o/
[3:00] <Cheaterman> you're the man
[3:00] <agronholm> :D
[3:00] <Cheaterman> thanks a lot agronholm bliblibliblibli
[3:00] <agronholm> no more patching needed
[3:00] <Cheaterman> It's gonna be so much more magic to work with Minecraft without Java
[3:01] <Cheaterman> Yeah I still need to prepend sqlalchemy.jar to my sys.path but I can live with that
[3:01] <agronholm> do you?
[3:01] <Cheaterman> you think I don't?
[3:01] <agronholm> not sure why you'd have to
[3:02] <Cheaterman> lemme try then
[3:02] <agronholm> oh, I mean, you have to put it in sys.path somehow
[3:02] <Cheaterman> I'd have to because it has no other way to find the jar otherwise
[3:02] <agronholm> or classpath
[3:02] <Cheaterman> yes
[3:02] <agronholm> well, that's a must
[3:02] <Cheaterman> It's really something I can live with, as I said :-)
[3:02] <agronholm> alright
[3:02] <Cheaterman> More importantly, got the funniest ORM to work, and the coolest language
[3:02] <Cheaterman> Thanks again agronholm blibliblibli ^__^
[3:03] <agronholm> yw :)
[3:03] <Cheaterman> Now we can brag about how we're the first who have gotten SQLAlchemy to work on a Minecraft server
[3:03] <Cheaterman> Because I don't think anyone else is crazy enough to try
[3:03] <Cheaterman> :D
[3:03] <agronholm> that might be true
[3:04] <Cheaterman> Big +1 for SQLAlchemy though, it really didn't get in the way, as soon as I had pymysql
[3:04] <Cheaterman> And big +1 for Jython for being able to be twisted and folded and pushed and pulled in all sorts of weird ways and still manage to get my python to run
[3:05] <Cheaterman> because I'm sure weird things must be done behind the scenes
[3:05] <Cheaterman> not so much on the Jython side, but the fact that I put Python inside Minecraft more generally
[3:08] <Cheaterman> agronholm: How does it work to select a .class vs a .py? Is it like a .pyc and a .py, it checks if .py is more recent?
[3:09] <agronholm> Cheaterman: I looked into that at one point and was disappointed by the lack of sophistication in that mechanism
[3:09] <agronholm> but it works *somewhat* like pyc vs py
[3:10] <agronholm> bbiab
[3:11] <Cheaterman> Okay :)
[3:18] * Kjq (601b0db1@gateway/web/freenode/ip.96.27.13.177) has joined #jython
[3:20] * Kjq (601b0db1@gateway/web/freenode/ip.96.27.13.177) Quit (Client Quit)
[3:30] <agronholm> back
[3:52] * JythonLogBot disconnected - trying to reconnect...
[3:56] -hobana.freenode.net- *** Looking up your hostname...
[3:56] -hobana.freenode.net- *** Checking Ident
[3:56] -hobana.freenode.net- *** Couldn't look up your hostname
[3:56] -hobana.freenode.net- *** No Ident response

Index

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