DeNA/HandyRL

OSError when running on Windows

benoitdescamps opened this issue · 4 comments

Hey guys, thanks for the amazing work.

I have been trying to run your library on windows. I seem to keep encountering following issue

Exception in thread Thread-2:
Traceback (most recent call last):
  File "D:\ProgramData\Anaconda3\envs\handyRL\lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "D:\ProgramData\Anaconda3\envs\handyRL\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "D:\Projects\Kaggle\HandyRL\handyrl\connection.py", line 254, in _recv_thread
    conn_list, _, _ = select.select(self.conns, [], [], 0.3)
OSError: [WinError 10022] An invalid argument was supplied

Thanks for the report.
Since we have not tested this code on Windows, it's so helpful for us.

This problem seems to be caused by a difference of select() function between Windows and Unix.

https://docs.python.org/3/library/select.html

Note File objects on Windows are not acceptable, but sockets are.
On Windows, the underlying select() function is provided by the WinSock library,
and does not handle file descriptors that don’t originate from WinSock.

Could you try

conn_list = mp.connection.wait(self.conns, 0.3)

instead of

conn_list, _, _ = select.select(self.conns, [], [], 0.3)

, please?

I confirm that it solves the problem. Thanks a lot!

That's good to hear!

We will apply this update after some checks.

Solved in #162