Bug: Can't run on Termux

オープン 初心者向け
#969 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@sqbi-q がすでに取り組んでいます。

2026年8月10日 から。

  • #970 @sqbi-q による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
python
領域
cli

調査の方向性

まず meshtastic/util.py を読んで、serial.tools.list_ports がインポートされていることを確認し、meshtastic/__main__.py 経由で CLI のエントリーポイントを追跡します。Termux または同等の環境で未対応プラットフォームのインポートを再現し、列挙例外が発生せずにライブラリの使用を続けられるようにインポート処理を変更します。Termux で Meshtastic をインポートして CLI を実行してもクラッシュしなくなったことを確認し、プラットフォーム固有のシリアルポートの動作に関する関連テストを追加または実行します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
855
フォーク
355
平均マージ
3日 3時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

meshtastic/python のほかの issue

meshtastic/python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。