Message6590

Author amak
Recipients amak, mitra
Date 2011-07-30.00:06:18
SpamBayes Score 1.05358e-05
Marked as misclassified No
Message-id <1311984379.31.0.459163115553.issue1778@psf.upfronthosting.co.za>
In-reply-to
Content
Unfortunately, as you have discovered, stdin and stdout are not selectable objects on the Java Virtual Machine.

http://wiki.python.org/jython/SelectModule#Only_sockets_can_be_multiplexed.2C_not_files_or_any_other_IO_channel

This is a fundamental limitation of java, and thus cannot be solved in jython.

Your only solution is to use channels that *are* selectable in java, and thus jython.

In the current jython implementation, the only selectable IO channels are AF_INET and AF_INET6 sockets.

To make your scenario work, you must

1. Make your parent process open a socket using the "listen" call.
2. Make your child process connect to the parent using the "connect" call.
3. Make the two communicate over that socket.

To see some examples of such client to server communication, between threads, see the Lib/test_socket.py module.

To see examples of such client to server communications, between processes, see this article

http://docs.python.org/release/2.5.2/lib/socket-example.html

Without knowing more about the nature of the communications between your parent and child, I cannot make any further recommendations. If you want alternative solutions, I suggest a question on the jython-users mailing list, providing more details of your use case.
History
Date User Action Args
2011-07-30 00:06:19amaksetmessageid: <1311984379.31.0.459163115553.issue1778@psf.upfronthosting.co.za>
2011-07-30 00:06:19amaksetrecipients: + amak, mitra
2011-07-30 00:06:19amaklinkissue1778 messages
2011-07-30 00:06:18amakcreate