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. |