Why is the same code not running now?
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- embedded-iot
調査の方向性
まず、指定されたCanableハードウェア、slcanインターフェース、オペレーティングシステム、Pythonのバージョン、python-canのバージョンを使用して、提供されたスクリプトを再現します。can.interface.BusとAsyncBufferedReaderのエントリーポイントを調べ、不足しているトレースバックまたはログを収集します。再現可能な原因を特定して対応可能なレポートにまとめるか、問題が環境に起因するものでpython-canのバグではないことを記録できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
I used to be able to successfully obtain data using the following code, but now the data cannot be displayed
The hardware I am using is Canable.
Additional context
OS and version:Windows10/Ubuntu 24.04
Python version:Python3.10/Python3.12
python-can version:4.2.0/4.4.2
python-can interface/s (if applicable):slcan
Traceback and logs
The environment that was once able to run successfully:
cantools==39.3.0
mqtt==0.0.1
paho-mqtt==1.6.1
pyserial==3.5
python-can==4.2.0
this is my code example,It was once able to run successfully.
# This is a sample Python script.
import asyncio
import time
from typing import List
import can
from can.notifier import MessageRecipient
# import cantools
import serial.tools.list_ports
# import paho.mqtt.client as mqtt
# import json
# client = mqtt.Client()
# db = cantools.database.load_file('.\wuling.dbc')
def on_connect(client, userdata, flags, rc):
print(f"Connected with result code {rc}")
async def main() -> None:
port = None
ports_list = list(serial.tools.list_ports.comports())
if len(ports_list) <= 0:
print("无串口设备,即将退出...")
time.sleep(2)
exit(0)
else:
print("可用的串口设备如下:")
for comport in ports_list:
print(comport.name + ",描述:" + str(comport.description) + ",设备ID:" + str(comport.vid) + ":" + str(
comport.pid))
for comport in ports_list:
if comport.pid == 4478 and comport.vid == 5840:
print("选择第一个CAN设备:" + comport.name + " " + str(comport.description))
port = comport
break
if port is None:
print("未发现CAN设备,即将退出...")
time.sleep(2)
exit(0)
# client.on_connect = on_connect
# client.username_pw_set(username="user", password="user")
# client.connect("127.0.0.1", 1883, 60)
"""The main function that runs in the loop."""
with can.interface.Bus(bustype='slcan', channel=str(port.name), bitrate=500000, ) as bus:
reader = can.AsyncBufferedReader()
listeners: List[MessageRecipient] = [
reader,
]
loop = asyncio.get_running_loop()
notifier = can.Notifier(bus, listeners, loop=loop)
while True:
msg = await reader.get_message()
try:
print(msg)
except Exception as ex:
print(ex)
pass
pass
if __name__ == "__main__":
asyncio.run(main())
- 主要言語
- Python
- スター
- 1.6k
- フォーク
- 697
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hardbyte/python-can のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
hardbyte/python-can#2103 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
hardbyte/python-can#2077 · コメント 1 件 · リアクション 1 件 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
hardbyte/python-can#1922 · リアクション 1 件 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
hardbyte/python-can#2102 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
hardbyte/python-can#2092 ·
hardbyte/python-can の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
stephrobert/dsoxlab#238 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
sublimehq/package_control#1780 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
nwg-piotr/nwg-displays#145 ·