Skip to content

Drop unused telnetlib import that breaks two scripts on Python 3.13 - #445

Open
kasparovabi wants to merge 1 commit into
greearb:masterfrom
kasparovabi:fix/py313-unused-telnetlib
Open

kasparovabi wants to merge 1 commit into
greearb:masterfrom
kasparovabi:fix/py313-unused-telnetlib

Conversation

@kasparovabi

Copy link
Copy Markdown

Python 3.13 removed telnetlib (PEP 594, What's New in 3.13). openwrt_ctl.py and tos_plus_auto.py import it at the top but never use it, so on 3.13 both scripts stop before parsing arguments.

File Change
openwrt_ctl.py remove import telnetlib (line 30)
tos_plus_auto.py remove import telnetlib (line 26)

Neither file refers to telnetlib anywhere else. Both drive their sessions through pexpect.

What I ran, in python:3.12-slim and python:3.13-slim containers with no network and a stub pexpect module on the path:

$ python3.13 openwrt_ctl.py --help      # before
    import telnetlib
ModuleNotFoundError: No module named 'telnetlib'
$ python3.13 openwrt_ctl.py --help      # after
usage: openwrt_ctl.py [-h] ...

tos_plus_auto.py gives the same result. On 3.12 the --help output of both scripts is byte for byte the same before and after the change. Both files still parse under Python 3.7, the version the lint job uses. I did not run them against a LANforge system or an OpenWrt device.

Four other files also import telnetlib, and these ones actually call telnetlib.Telnet, so I left them alone. They are mux_client.py, py-scripts/lf_rfgen_info.py, py-scripts/sandbox/custom_sta_telnet.py and py-scripts/sandbox/iot_traffic.py. Replacing them means picking a new client (a raw socket, pexpect, or a third party package), which is your call.

Happy to adjust this or close it if it does not fit the project.

Python 3.13 removed telnetlib (PEP 594), so both scripts fail at import
with ModuleNotFoundError. Neither script references telnetlib beyond the
import line.
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

Successfully merging this pull request may close these issues.

1 participant