hardbyte / hardbyte/python-can

Handling cantimeout exception

Aperta
#1,550 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
1.6k
Fork
697
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I have written a code that receives a message for certain timeout, if the timeout exceeds and no message was sent it raises the CanTimeoutError flag.
when i ran the program, the exception doesn't get executed.
this is the code i wrote
```
import can

with can.Bus(interface="socketcan", channel="vcan0") as bus:
try:
msg=bus.recv(1)
print(msg)
except can.CanTimeoutError:
print("timeout exceeded")
```

Does someone have any idea how to resolve this issue ?

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.