Thanks to visit codestin.com
Credit goes to github.com

Skip to content

vcan_filtered example throws error #1812

@matrix-morpheus

Description

@matrix-morpheus

Describe the bug

The output of running the vcan_filtered.py code

Timestamp: 1720528753.615074    ID: 00000001    X Tx                DL:  0
Exception in thread can.notifier for bus "Virtual bus channel None":
>>> Traceback (most recent call last):
  File "C:\Users\matrix\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "C:\Users\matrix\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "c:\Work\PythonEnv\Lib\site-packages\can\notifier.py", line 126, in _rx_thread
    if msg := bus.recv(self.timeout):
              ^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Work\PythonEnv\Lib\site-packages\can\bus.py", line 127, in recv
    msg, already_filtered = self._recv_internal(timeout=time_left)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Work\PythonEnv\Lib\site-packages\can\interfaces\virtual.py", line 129, in _recv_internal
    self._check_if_open()
  File "c:\Work\PythonEnv\Lib\site-packages\can\interfaces\virtual.py", line 124, in _check_if_open
    raise CanOperationError("Cannot operate on a closed bus")
can.exceptions.CanOperationError: Cannot operate on a closed bus

To Reproduce

python ./examples/vcan_filtered.py

Expected behavior

No errors

Additional context

OS and version: windows 10
Python version: 3.12.3
python-can version: 4.4.2
python-can interface/s (if applicable):

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions