Repository navigation
Open
Description
Importing serial.tools.list_ports causes an exception when the platform is unsupported. This stops both CLI and import of Meshtastic as a library. One of those unsupported platforms is Termux (detected as posix). Termux should be able to run Meshtastic as the documentation provides install instructions for this platform, though.
~ $ meshtastic
don't know how to enumerate ttys on this system.
! I you know how the serial ports are named send this information to
! the author of this module:
sys.platform = 'android'
os.name = 'posix'
pySerial version = 3.5
also add the naming scheme of the serial ports and with a bit luck you can get
this module running...
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/bin/meshtastic", line 3, in <module>
from meshtastic.__main__ import main
File "/data/data/com.termux/files/usr/lib/python3.14/site-packages/meshtastic/__init__.py", line 88, in <module>
from meshtastic.node import Node
File "/data/data/com.termux/files/usr/lib/python3.14/site-packages/meshtastic/node.py", line 11, in <module>
from meshtastic.util import (
...<10 lines>...
)
File "/data/data/com.termux/files/usr/lib/python3.14/site-packages/meshtastic/util.py", line 22, in <module>
import serial.tools.list_ports # type: ignore[import-untyped]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.14/site-packages/serial/tools/list_ports.py", line 31, in <module>
from serial.tools.list_ports_posix import comports
File "/data/data/com.termux/files/usr/lib/python3.14/site-packages/serial/tools/list_ports_posix.py", line 114, in <module>
raise ImportError("Sorry: no implementation for your platform ('{}') available".format(os.name))
ImportError: Sorry: no implementation for your platform ('posix') available
My suggested fix is to wrap import between try-except block:
import serial
try:
import serial.tools.list_ports
except ImportError as e:
print("Error: ", e)
print("Error: Cannot list ports on this platform")
print("Warning: Skipping import serial.tools.list_ports")in meshtastic/util.py.
Metadata
Metadata
Assignees
Labels
No labels
Activity