Issue1251

classification
Title: select() fails when selecting on a file descriptor.
Type: behaviour Severity: normal
Components: Library Versions: 2.5b1
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: amak, cartman
Priority: Keywords:

Created on 2009-01-27.09:11:52 by cartman, last changed 2009-01-28.13:15:05 by amak.

Messages
msg4086 (view) Author: İsmail Dönmez (cartman) Date: 2009-01-27.09:11:51
Test code:

import os
from select import select

fp=os.open("foo.txt",os.O_WRONLY|os.O_CREAT)
select([fp],[],[],0)

running with jython 2.5b1 results in:

Traceback (most recent call last):
  File "test.py", line 5, in <module>
    select([fp],[],[],0)
  File "/usr/bin/jython/Lib/select.py", line 176, in native_select
  File "/usr/bin/jython/Lib/select.py", line 95, in register
  File "/usr/bin/jython/Lib/select.py", line 95, in register
  File "/usr/bin/jython/Lib/select.py", line 56, in _getselectable
TypeError: ("Object 'org.python.core.io.FileIO@13b4cd65' is not
watchable", 88)

Java version:

java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b16, mixed mode)

running on Linux.
msg4095 (view) Author: Alan Kennedy (amak) Date: 2009-01-28.13:15:04
This is expected behaviour.

On java, and thus on jython, *only* sockets can be selected upon.

Files *cannot* be selected upon, because the FileChannels underlying
"file descriptors" on jython do not subclass
java.nio.channels.SelectableChannel.

I have updated the documentation on the select module wiki page to make
this more explicitly clear.

http://wiki.python.org/jython/SelectModule#Onlysocketscanbemultiplexed.2CnotfilesoranyotherIOchannel
History
Date User Action Args
2009-01-28 13:15:05amaksetstatus: open -> closed
resolution: invalid
messages: + msg4095
nosy: + amak
title: select() fails -> select() fails when selecting on a file descriptor.
2009-01-27 09:11:53cartmancreate