hardbyte / hardbyte/python-can

Handling cantimeout exception

Open
#1,550 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.6k
Forks
697
PR merge metrics
No merged PRs in 30d

Description

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 ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.