Meshtastic Python CLI Serial timeout bug?

I’ve noticed that since around 1.2.28, my python command line calls mostly fail with an Exception: Timed out waiting for connection completion

I’ve done some more testing, across multiple machines (Windows and Linux) to try get the the bottom of this now and the behaviour seems to have really ramped up to be more likely to timeout than succeed since 1.2.28. These serial timeouts are so frequent that it is now unusable as a fixed router node with USB coms.

Here’s the typical behaviour from meshtastic python 1.2.33.

meshtastic --info
Traceback (most recent call last):
File “C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py”, line 197, in run_module_as_main
return run_code(code, main_globals, None,
File “C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py”, line 87, in run_code
exec(code, run_globals)
File "C:\Users\avron\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\meshtastic.exe_main
.py", line 7, in
File "C:\Users\avron\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\meshtastic_main
.py", line 622, in main
common()
File "C:\Users\avron\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\meshtastic_main
.py", line 470, in common
client = SerialInterface(
File “C:\Users\avron\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\meshtastic_init_.py”, line 935, in init
StreamInterface.init(
File “C:\Users\avron\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\meshtastic_init_.py”, line 771, in init
self.connect()
File “C:\Users\avron\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\meshtastic_init_.py”, line 793, in connect
self.waitConnected()
File "C:\Users\avron\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\meshtastic_init
.py", line 422, in _waitConnected
raise Exception(“Timed out waiting for connection completion”)
Exception: Timed out waiting for connection completion

I experienced the same issue on a Windows machine with Heltec boards on device version 1.2.30. I’d reverted from 1.2.28 to 1.2.11 due to some other reliability issues which still works very well for my purposes including in the CLI.

The problem seems less pronounced on the RAK Wireless Wisblock board that runs 1.2.30 though it did timeout once.

I think someone pointed out in another thread there was a workaround within Python, but it was way over my head.

The RAKWireless Wisblock is no longer responding to the CLI at all. When I attempt to reflash it, the file will not copy to the bootloader. It stops at around 38% and errors out.

Similar to other reports, it times out of the CLI with this traceback regardless of the command sent:

C:\Users\herro>meshtastic --reboot
Traceback (most recent call last):
  File "c:\users\herro\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\herro\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\herro\AppData\Local\Programs\Python\Python39\Scripts\meshtastic.exe\__main__.py", line 7, in <module>
  File "c:\users\herro\appdata\local\programs\python\python39\lib\site-packages\meshtastic\__main__.py", line 622, in main
    common()
  File "c:\users\herro\appdata\local\programs\python\python39\lib\site-packages\meshtastic\__main__.py", line 470, in common
    client = SerialInterface(
  File "c:\users\herro\appdata\local\programs\python\python39\lib\site-packages\meshtastic\__init__.py", line 935, in __init__
    StreamInterface.__init__(
  File "c:\users\herro\appdata\local\programs\python\python39\lib\site-packages\meshtastic\__init__.py", line 771, in __init__
    self.connect()
  File "c:\users\herro\appdata\local\programs\python\python39\lib\site-packages\meshtastic\__init__.py", line 793, in connect
    self._waitConnected()
  File "c:\users\herro\appdata\local\programs\python\python39\lib\site-packages\meshtastic\__init__.py", line 422, in _waitConnected
    raise Exception("Timed out waiting for connection completion")
Exception: Timed out waiting for connection completion
1 Like

I think I’ve seen this as well. When I posted about fixed lat/lon and negative values I was running into timeouts if I put in a command to soon after another. Waiting seemed to fix it, and the lights on my tbeam were always solid until the timeout window had passed, once they were blinking again I could typically run a command.

I also was impatient so I reset a couple times and that also fixed the issue.

Hi All,
First message here. Still in the process of sorting ignorance from issues, but here I found something that had an effect. ‘meshtastic --nodes’ resulted in a timeout for me too, but setting the proper baudrate did help: ‘stty -F /dev/ttyACM0 ospeed 9600’.
Setting/checking the baudrate might be a good addition to the /docs/software/python/python-cli page.

This is on a T3_V1.6.1 board with firmware 1.2.50.