#jython IRC Log (v0.9)

Index

IRC Log for 2012-05-24

Timestamps are in GMT/BST.

[0:00] <Thunderbird> that's also related to the issue I had?
[0:02] <Thunderbird> did some more tests with the pysystemstate stuff but kept having issues related to import
[0:03] <fwierzbicki> this is on 2.7 only
[0:03] <fwierzbicki> the details are here: http://bugs.jython.org/issue1892
[0:03] <Thunderbird> I was on 2.7 as well, so it is likely related
[0:04] <Thunderbird> thanks
[0:06] <fwierzbicki> ah - so site-packages isn't in the path for 2.7 - though this would not cause trouble with sys
[0:07] * ivan` (~ivan@unaffiliated/ivan/x-000001) has joined #jython
[0:07] * sabi (~nriley@osric.zoiks.net) has joined #jython
[0:10] <Thunderbird> my java code sees 2 'jython objects' and I would like one of them to reference the other on the python side
[0:10] <Thunderbird> how can I pass python references through java? I tried using Py.java2py, is that the correct method? I'm not sure how objects are getting wrapped
[0:19] <Thunderbird> that seems to work
[0:22] <Thunderbird> a=1234
[0:23] <Thunderbird> print("a={0}\n".format(a))
[0:23] <Thunderbird> works in the jython console
[0:23] <Thunderbird> when embedded jython 2.7a1 from java: AttributeError: 'string' object has no attribute 'format'
[0:24] <agronholm> wait, "string", not "str"?
[0:25] <Thunderbird> yes string
[0:26] <agronholm> if you do "print type('')" from the embedded interpreter, what do you get?
[0:27] <Thunderbird> prints a blank line
[0:27] <Thunderbird> so printing a string works fine from the 2.7a1 jython binary, but not when embedded
[0:27] <Thunderbird> oh, wait didn't try on the embedded interpreter
[0:28] <agronholm> what did you try that with then
[0:28] <agronholm> it's supposed to print "<type 'str'>"
[0:28] <Thunderbird> misread, let me retry
[0:29] <Thunderbird> [java] <type 'str'>
[0:29] <Thunderbird> from embedded python
[0:29] <Thunderbird> for: print type('')
[0:30] <agronholm> but then '{0}'.format(1) does not work?
[0:30] <agronholm> from embedded
[0:30] <Thunderbird> correct
[0:31] <agronholm> can you do a dir() on '{0}' and tell me what it gives you?
[0:31] <Thunderbird> sure
[0:32] <Thunderbird> that prints a lot of stuff: [java] ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__repr__', '__rmul__', '__setattr__', '__str__', '__unicode__', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs
[0:32] <Thunderbird> ', 'find', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'islower', 'isnumeric', 'isspace', 'istitle', 'isunicode', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
[0:32] <Thunderbird> I guess that's fine
[0:32] <agronholm> nope, format is missing
[0:33] <Thunderbird> correct
[0:33] <Thunderbird> when I do the same from the console, format is shown
[0:33] <agronholm> are you sure your embedded jython is 2.7?
[0:33] <Thunderbird> is there an easy way to get the version?
[0:33] <agronholm> sys.version_info
[0:34] <Thunderbird> argggggg, it isn't 2.7
[0:34] <agronholm> haha
[0:34] <Thunderbird> that may be why I was having issues all day
[0:34] <agronholm> would've though that'd be the first thing to check
[0:34] <Thunderbird> the ant file referenced something else
[0:34] <Thunderbird> sometimes you are sure, you didn't mess something minor up ..
[0:35] <Thunderbird> sorry for the trouble
[0:35] <agronholm> no worries
[0:40] * fwierzbicki_ (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) has joined #jython
[0:40] * fwierzbicki (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) Quit (Read error: Connection reset by peer)
[0:40] * fwierzbicki_ is now known as fwierzbicki
[0:57] * fwierzbicki (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) Quit (Quit: fwierzbicki)
[8:11] * agronholm (~Demi-god@nblzone-211-37.nblnetworks.fi) Quit (Read error: Operation timed out)
[8:12] * agronholm (~Demi-god@83.145.211.37) has joined #jython
[8:12] * ChanServ sets mode +o agronholm
[10:05] * Rondom (~rondom@2a01:488:66:1000:b24d:4f2f:0:1) Quit (Remote host closed the connection)
[10:05] * Rondom (~rondom@2a01:488:66:1000:b24d:4f2f:0:1) has joined #jython
[10:42] * clajo04_ (~clajo04_@pool-108-41-219-3.nycmny.fios.verizon.net) Quit (Read error: Connection reset by peer)
[10:42] * clajo04_ (~clajo04_@pool-108-41-219-3.nycmny.fios.verizon.net) has joined #jython
[11:13] * juneau001 (~juneau@131.225.24.144) has joined #jython
[12:26] * wainersm (~wainersm@189.61.204.85) has joined #jython
[13:51] * seletz (~seletz@business-178-015-118-087.static.arcor-ip.net) Quit (Quit: seletz)
[15:19] * varialus (cfe0d5b3@gateway/web/freenode/ip.207.224.213.179) Quit (Quit: Page closed)
[15:36] * varialus (cfe0d5b3@gateway/web/freenode/ip.207.224.213.179) has joined #jython
[16:45] * fwierzbicki (~frank@99-106-170-105.lightspeed.sntcca.sbcglobal.net) has joined #jython
[18:03] * Oti (~ohumbel@adsl-84-227-63-136.adslplus.ch) has joined #jython
[19:11] * juneau001 (~juneau@131.225.24.144) Quit (Quit: juneau001)
[19:20] <varialus> Are there any plans to change os.name in version 2.7? I think a greater level of compatibility would be achieved by adding OS specific modules to Jython via JNA/JNAerator/Bridj/JNI. Expecting everyone who doesn't use Jython to adapt to Jython seems unrealistic.
[19:21] <agronholm> a lot of projects already have adapted from what I know
[19:21] <varialus> Oh, I'm new to Jython and was only using a sample size of one. Selenium.
[19:21] <agronholm> under jython, you can access the real OS name at os._name
[19:22] <varialus> Yeah, it just doesn't feel "right"
[19:22] <agronholm> in any event, that won't change in jython 2.x
[19:22] <varialus> I was trying to get selenium to work, but it doesn't open the web browser correctly.
[19:22] <agronholm> 3.3+? we'll see
[19:24] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython
[19:24] <varialus> Well, I guess it's not that Selenium doesn't adapt to Jython, it's just that subprocess doesn't work right.
[19:25] <varialus> I thought that the "right" way to fix it would be to get Jython to identify itself as Windows, but once I make that change, there's a whole bunch more to fix.
[19:34] <varialus> I got around some problems, but line below is the line that I was sort of stuck on. I was making progress, but I think I was going about it incorrectly and thus making the problem bigger than it needs to be.
[19:34] <varialus> Popen([self._start_cmd, "-silent"], stdout=PIPE, stderr=STDOUT,env=self._firefox_env).wait()
[19:34] <pjenvey> the best thing you can do is check for the feature itself, not necessarily the platform. but that doesn't cover every case
[19:35] <pjenvey> ie hasattr(os, 'fork') instead of os.name == 'nt'
[19:35] <pjenvey> speaking of fork, that's one of the good reasons why we wouldn't ever have os.name be 'posix', we can't realistically provide fork
[19:35] <pjenvey> varialus - what broke with that?
[19:36] <varialus> It just hangs.
[19:36] <varialus> I think that it's a input/output buffer problem.
[19:37] <varialus> I changed wait() to communicate and that solved it, but then the next line opens the browser and keeps it open and that one times out.
[19:37] <pjenvey> check the warning on the subprocess docs about deadlocks (I actually added some of those because some cases were maybe more easily encountered on jython)
[19:37] <pjenvey> right, you should be using communnicate
[19:37] <pjenvey> not sure what you mean by the next line timing out
[19:38] <varialus> one sec
[19:39] <varialus> This is the next line.
[19:39] <varialus> self.process = Popen([self._start_cmd, "-foreground"], stdout=PIPE, stderr=STDOUT,env=self._firefox_env)
[19:40] <varialus> So it opens the browser silently and then in the foreground. I'm not sure exactly why, but it seems I may have known why a long long time ago.
[19:41] <varialus> I'm not sure whether when it opens silently, it should stay open in the background or close or what.
[19:41] <pjenvey> what's the controlling program supposed to do, just continue on?
[19:41] <pjenvey> ie not block, run the browser in the background as it continues on?
[19:43] <varialus> I'm not sure, but I know that in CPython and Java, it doesn't get stuck on that line. I think Java selenium opens it asynchronously, come to think of it.
[19:44] <varialus> So I can just use selenium.jar, but I'd rather use the Python version of Selenium.
[19:45] <pjenvey> are you 100% sure it's blocking on that line? that's kind of surprising
[19:46] <varialus> Yes, I'm sure. I'm not sure whether it matters whether Firefox is already open or not. In CPython and Java it doesn't matter.
[19:46] <varialus> But I can double check. Just a minute.
[19:48] <pjenvey> if it's there a full JVM stack trace would be helpful, ctrl-\ on posix, ctrl-pause on windows IIRC
[19:48] <pjenvey> will dump one out
[19:51] <varialus> Oh evil. It's working right now. Gonna try with Firefox not already started.
[19:52] * varialus_ (cfe0d5b3@gateway/web/freenode/ip.207.224.213.179) has joined #jython
[19:52] * varialus (cfe0d5b3@gateway/web/freenode/ip.207.224.213.179) Quit (Quit: Page closed)
[19:52] * varialus_ is now known as varialus
[19:53] <pjenvey> running that last line via stdout=PIPE is still probably not a great idea
[19:54] <pjenvey> if you don't care about the output this would be safer: with open(os.devnull, 'w') as devnull: ..., stdout=devnull
[19:55] <pjenvey> actually you wouldn't want that in a with statement for that case =]
[19:57] <varialus> As I recall, it may have had something to do with a program on my computer that was trying to install a Firefox addon/extension that I didn't want. When I would force restart firefox which in the process viewer was under Java, it would restart Firfox with the addon/extension notification.
[20:01] <varialus> I'm not sure how it "should" or "shouldn't" be coded. I just try to work around errors that I'm encountering. Here's where those lines are located.
[20:01] <varialus> https://code.google.com/p/selenium/source/browse/trunk/py/selenium/webdriver/firefox/firefox_binary.py
[20:01] <varialus> lines 65 through 69
[20:02] <varialus> 64-68
[20:03] <varialus> I think I'll try from a fresh install because I have fixed various errors, but I don't remember fixing this one.
[20:03] <pjenvey> either use communicate() or don't use PIPE. PIPE buffers can fill up if you're not consuming them, and then you have deadlocks
[20:55] * Arfrever (~Arfrever@apache/committer/Arfrever) has joined #jython
[21:55] * wainersm (~wainersm@189.61.204.85) Quit (Quit: Ex-Chat)
[22:04] <Oti> fwierzbicki: i have now a hg repository with a 2.2 and a 2.5 branch, but without history: hg clone ssh://hg@bitbucket.org/ohumbel/jython-installer
[22:05] <Oti> to verify, i'll try to integrate it into the build over the weekend
[22:08] <fwierzbicki> Oti: great! Meanwhile I plan to put out a 2.7a2 and a 2.5.3b2 today or tomorrow
[22:08] <fwierzbicki> I'm sure I'll have more releases to do soon anyway :)
[22:09] <Oti> fwierzbicki: i hope this get's at least a little easier soon
[22:10] <fwierzbicki> Oti: it's actually not *that* bad - I need to document the differences, but I'll wait until everything is on hg
[22:11] <Oti> sure
[22:11] <Oti> what is missing besides installer - website?
[22:48] <fwierzbicki> Oti: I think the installer is really it - I don't think website is used anymore - though Josh would know more about that
[22:48] <fwierzbicki> I think Josh has an hg repo with the current website
[23:25] <Thunderbird> there will be a 2.7a2 tarball or something somwhere? need to create a dev package for internal use for stressing 2.7a2 and it would be nice if I could avoid using hg all the time

Index

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