Message6579

Author mitra
Recipients mitra
Date 2011-07-23.06:56:59
SpamBayes Score 1.1157741e-14
Marked as misclassified No
Message-id <1311404220.45.0.245822720868.issue1778@psf.upfronthosting.co.za>
In-reply-to
Content
I am creating a jython program which is started as a subprocess from python. The stdin and stdout are used to send pickled data which is used to call a java library. The jython process is constantly waiting in read and respond loop on the stdin and stdout. Since the pickle.load throws an exception if there is no data in the pipe, I decided to use select to wait until we have data on the stdin before calling the pickle. Unfortunately select is not working. I have reduced the reproduction case to a 3-liner which can be tried on the interactive prompt. Since this is holding up the project I am working on I would really appreciate if there is a known work-around which I can used till the time the bug is resolved.

The same 3-liner works perfectly in python.

$ java -classpath /opt/jython2.5.2/jython.jar  org.python.util.jython
Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06) 
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_20
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import select
>>> select.select([sys.stdin], [], [])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/jython2.5.2/Lib/select.py", line 225, in native_select
    pobj.register(fd, POLLIN)
  File "/opt/jython2.5.2/Lib/select.py", line 98, in register
    channel = _getselectable(socket_object)
  File "/opt/jython2.5.2/Lib/select.py", line 98, in register
    channel = _getselectable(socket_object)
  File "/opt/jython2.5.2/Lib/select.py", line 59, in _getselectable
    raise TypeError("Object '%s' is not watchable" % selectable_object,
TypeError: ("Object '<open file '<stdin>', mode 'r' at 0x2>' is not watchable", 88)
>>>
History
Date User Action Args
2011-07-23 06:57:00mitrasetrecipients: + mitra
2011-07-23 06:57:00mitrasetmessageid: <1311404220.45.0.245822720868.issue1778@psf.upfronthosting.co.za>
2011-07-23 06:57:00mitralinkissue1778 messages
2011-07-23 06:56:59mitracreate