Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes on client connection: io.UnsupportedOperation: fileno #6

Open
sigurdo opened this issue May 24, 2023 · 2 comments
Open

Crashes on client connection: io.UnsupportedOperation: fileno #6

sigurdo opened this issue May 24, 2023 · 2 comments

Comments

@sigurdo
Copy link

sigurdo commented May 24, 2023

Python version: 3.10.11

I am currently trying to use ser2tcp to forward a COM port on Windows to WSL2 over TCP, but the connection crashes with the following error as soon as I connect the client:

ser2tcp.exe -c .\ser2tcp_config.json
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\sigur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\ser2tcp.exe\__main__.py", line 7, in <module>
  File "C:\Users\sigur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ser2tcp\main.py", line 53, in main
    servers_manager.process()
  File "C:\Users\sigur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ser2tcp\server_manager.py", line 20, in process
    read_sockets = _select.select(sockets, [], [], .1)[0]
io.UnsupportedOperation: fileno

Here is my config:

[
    {
        "serial": {
            "port": "COM7",
            "baudrate": 57600,
            "parity": "NONE",
            "stopbits": "ONE"
        },
        "servers": [
            {
                "address": "127.0.0.1",
                "port": 10001,
                "protocol": "TCP"
            },
            {
                "address": "0.0.0.0",
                "port": 10002,
                "protocol": "TELNET"
            },
            {
                "address": "172.29.176.1",
                "port": 10003,
                "protocol": "TCP"
            }
        ]
    }
]

172.29.176.1 is the IP address of Windows on the Windows-WSL2 ethernet adapter.

On the WSL side I use socat to forward TCP to a virtual COM port with the following command:

sudo socat  pty,link=/dev/virtualcom0,raw  tcp:172.29.176.1:10003

socat returns with no error message and no error code. I know nothing about socat, just copied the command from this stackoverflow post, so I might very well be using it wrong. Does anyone know what I might be doing wrong, or if there could be a bug in ser2tcp?

@sigurdo sigurdo changed the title Crashes as soon as connection is set up io.UnsupportedOperation: fileno May 24, 2023
@sigurdo sigurdo changed the title io.UnsupportedOperation: fileno Crashes on client connection: io.UnsupportedOperation: fileno May 24, 2023
@xingguang777
Copy link

Did you solve this issues ? This error occured on my window 10 and python 3.11 too ?It might be caused by the version of python

@bcm56504
Copy link

The windows system does not support ‘select’, I am not sure how to handle it. You can try starting a separate thread to monitor and read data from the serial port. This may solve the problem, I guess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants