#jython IRC Log

Index

IRC Log for 2015-09-30

Timestamps are in GMT/BST.

[0:53] * gopar (~gopar@xnat-55.csumb.edu) has joined #jython
[1:42] * dew3y (U2FsdGVkX1@ma.sdf.org) Quit (Remote host closed the connection)
[1:42] * dew3y (U2FsdGVkX1@ma.sdf.org) has joined #jython
[1:58] * fwierzbicki1 (~Adium@99-106-169-5.lightspeed.sntcca.sbcglobal.net) has joined #jython
[1:59] * fwierzbicki (~Adium@99-106-169-5.lightspeed.sntcca.sbcglobal.net) Quit (Ping timeout: 250 seconds)
[2:46] * gopar (~gopar@xnat-55.csumb.edu) Quit (Ping timeout: 250 seconds)
[4:25] * gopar (~gopar@c-73-162-171-146.hsd1.ca.comcast.net) has joined #jython
[5:16] * gopar (~gopar@c-73-162-171-146.hsd1.ca.comcast.net) Quit (Quit: Leaving)
[8:00] -mquin- [Global Notice] On or around Friday, October 2nd we will be cleaning up the services database. Now's a good time to ensure you identify to services when connecting. Check out http://blog.freenode.net/2015/09/services-database-purge/
[8:15] * eatkin (~eatkin@166.70.212.121) Quit (Ping timeout: 260 seconds)
[8:15] * eatkin (~eatkin@166.70.212.121) has joined #jython
[9:16] * koo5 (~sirdancea@236.152.broadband3.iol.cz) has joined #jython
[13:33] * xemdetia (xemdetia@nat/ibm/x-tgpfpqfzhwfnpcbf) has joined #jython
[15:56] * eatkin (~eatkin@166.70.212.121) Quit (Quit: ZNC - http://znc.in)
[15:58] * eatkin (~eatkin@166.70.212.121) has joined #jython
[17:00] -mquin- [Global Notice] On or around Friday, October 2nd we will be cleaning up the services database. Now's a good time to ensure you identify to services when connecting. Check out http://blog.freenode.net/2015/09/services-database-purge/
[19:16] * guymatz (3f77a5a2@gateway/web/freenode/ip.63.119.165.162) has joined #jython
[19:18] <guymatz> Hi! noob here . . . how do I pass a file as an parameter to a java method? For example, f = open("new.xlsx", "w")
[19:18] <guymatz> But then when I try to use that in a java object: workbook = jxl.Workbook.getWorkbook(f) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: getWorkbook(): 1st arg can't be coerced to java.io.InputStream, java.io.File
[19:19] <guymatz> any thoughts are appreciated!
[19:34] <gthank> guymatz: I think the file is implemented as a wrapper around the relevant java streams
[19:34] <gthank> You might need to access the raw backing thing
[19:35] <guymatz> hmm . . . i didn't understand that . . .
[19:35] <guymatz> the raw backing thing?
[19:35] <guymatz> BTW, thanks for responding!
[19:37] <gthank> No problem.
[19:37] <gthank> I've seen you ask questions in here a couple of times
[19:38] <gthank> I basically don't use Jython objects from Java (I pretty much always do it the other way around)
[19:38] <gthank> But https://github.com/jythontools/jython/blob/master/src/org/python/core/PyFile.java is the source code for the implementation of the 'file' type in Jython
[19:39] <gthank> If I had to guess, that's basically what your Java code is seeing
[19:41] <gthank> guymatz I'd recommend dropping some debugging on it to find out for sure, though
[19:42] <gthank> Hello, https://github.com/jythontools/jython/blob/master/src/org/python/core/PyFile.java#L670 looks pretty interesting
[19:42] <guymatz> oh! So I can't use the normal python "file"? I need to use PyFile?
[19:43] <gthank> a 'file' **is** a PyFile
[19:43] <guymatz> or should that __to_java__ cast for me
[19:43] <guymatz> right
[19:44] <gthank> So from your Java code, you may need to invoke that __tojava__ method
[19:44] <gthank> Check out http://www.jython.org/jythonbook/en/1.0/JythonAndJavaIntegration.html#using-jython-within-java-applications
[19:44] <guymatz> oh! I thought that would magically happen. trying now . . .
[19:45] <gthank> Things like list actually implement List<>
[19:45] <guymatz> Yeah, I just read that . . .
[19:45] <gthank> Not sure why file doesn't
[19:46] <guymatz> should dir(f) show __tojava__ as an available method?
[19:46] <gthank> No
[19:46] <guymatz> :-) Wow. I have no idea what I'm doing
[19:46] <gthank> If I'm reading that properly, only Java code can see that
[19:46] <gthank> Are you embedding Jython into Java? Or the other way around?
[19:53] * gopar (~gopar@c-73-162-171-146.hsd1.ca.comcast.net) has joined #jython
[19:54] <guymatz> I'm trying to use java objects within jython
[19:58] <gthank> OK, let me see which one this is
[20:01] <guymatz> thanks!!
[20:01] * koo5 (~sirdancea@236.152.broadband3.iol.cz) Quit (Ping timeout: 272 seconds)
[20:02] <gthank> guymatz: Do you need Python's file functionality?
[20:03] <gthank> Because the easy way is to just import java.io.File (or java.io.InputStream, or whatever you need) and use that
[20:07] <guymatz> python's file seems easier to work with . . .
[20:07] <guymatz> I thought that was part of the point of jython, that I could mix & match and use what I like
[20:14] * eatkin (~eatkin@166.70.212.121) Quit (Ping timeout: 240 seconds)
[20:16] * eatkin (~eatkin@166.70.212.121) has joined #jython
[20:20] <gthank> This feels clunkier than I'd expect, but I think you can do something like this gist: https://gist.github.com/gthank/f531b724c969c26f6d8c
[20:21] <gthank> I'm really surprised that the 'file' type doesn't implement *something* useful from the Java side of things
[20:21] <gthank> So I'm guessing I'm making it way harder than it needs to be
[20:21] <guymatz> maybe. or maybe jython is not making it as easy as it could be?
[20:22] <guymatz> thanks for the help; i really do appreciate it. I'm going to go back to Cpython for now . . .
[21:21] * xemdetia (xemdetia@nat/ibm/x-tgpfpqfzhwfnpcbf) Quit (Ping timeout: 256 seconds)
[22:10] * gopar (~gopar@c-73-162-171-146.hsd1.ca.comcast.net) Quit (Quit: Leaving)
[22:10] * koo5 (~sirdancea@236.152.broadband3.iol.cz) has joined #jython
[22:13] * dew3y (U2FsdGVkX1@ma.sdf.org) Quit (Remote host closed the connection)
[22:14] * dew3y (U2FsdGVkX1@ma.sdf.org) has joined #jython
[23:14] * Cecil (~cecil@5350EE9B.cm-6-1d.dynamic.ziggo.nl) Quit (Ping timeout: 265 seconds)
[23:23] * robbyoconnor (~wakawaka@guifications/user/r0bby) Quit (Read error: Connection reset by peer)
[23:24] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython
[23:53] * Cecil (~cecil@5350EE9B.cm-6-1d.dynamic.ziggo.nl) 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.