huxuan/iptvtools

AttributeError: module 'socket' has no attribute 'SO_REUSEPORT'. Did you mean: 'SO_REUSEADDR'?

Coloradohusky opened this issue · 2 comments

Trying out your example given in the documentation gives me this error:

C:\Users\Coloradohusky\Downloads\IPTV>iptv-filter -i https://gist.githubusercontent.com/sdhzdmzzl/93cf74947770066743fff7c7f4fc5820/raw/11107d2dcfe2f5785e7ada94bb44c0cd349191c5/bj-unicom-iptv.m3u -t http://epg.51zmt.top:8000/test.m3u
  0%|                                                                                          | 0/165 [00:01<?, ?it/s]
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Coloradohusky\AppData\Roaming\Python\Python310\Scripts\iptv-filter.exe\__main__.py", line 7, in <module>
  File "C:\Users\Coloradohusky\AppData\Roaming\Python\Python310\site-packages\iptvtools\iptv_filter.py", line 74, in main
    playlist.filter()
  File "C:\Users\Coloradohusky\AppData\Roaming\Python\Python310\site-packages\iptvtools\models.py", line 160, in filter
    elif not utils.check_connectivity(url, self.args.timeout):
  File "C:\Users\Coloradohusky\AppData\Roaming\Python\Python310\site-packages\iptvtools\utils.py", line 98, in check_connectivity
    return check_udp_connectivity(parsed_url.netloc, timeout)
  File "C:\Users\Coloradohusky\AppData\Roaming\Python\Python310\site-packages\iptvtools\utils.py", line 108, in check_udp_connectivity
    sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
AttributeError: module 'socket' has no attribute 'SO_REUSEPORT'. Did you mean: 'SO_REUSEADDR'?

Windows 10, Python 3.10.6.

Maybe this has something to do with it?

Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK) constants exposed on the API which are not implemented on GNU/Hurd. They would not work at runtime anyway.

Hi @Coloradohusky,

Seems I can not reproduce the same error (with python 3.10.6 on Mac).

Would you prefer run the command python -c "import socket; print(socket.__file__); print(dir(socket))" to check the socket module is properly imported and double check the existence of SO_REUSERPORT attribute?