You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
In EtasBus _apply_filters, self._oci_filters is not defined when EtasBus init called with version 4.3.0 #1693
When I generate Bus object with 'etas', it gave me error messages dev = can.interface.Bus(interface='etas', channel='ETAS://USB/ES582.1:XXXXXX/CAN:1', bitrate=500000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "'Python Path'\lib\site-packages\can\util.py", line 378, in wrapper
return f(*args, **kwargs)
File "'Python Path'\lib\site-packages\can\interface.py", line 135, in Bus
bus = cls(channel, **kwargs)
File "'Python Path'\lib\site-packages\can\interfaces\etas\__init__.py", line 21, in __init__
super().__init__(channel=channel, **kwargs)
File "'Python Path'\lib\site-packages\can\bus.py", line 99, in __init__
self.set_filters(can_filters)
File "'Python Path'\lib\site-packages\can\bus.py", line 404, in set_filters
self._apply_filters(self._filters)
File "'Python Path'\lib\site-packages\can\interfaces\etas\__init__.py", line 222, in _apply_filters
if self._oci_filters:
AttributeError: 'EtasBus' object has no attribute '_oci_filters'. Did you mean: 'set_filters'?
I used etas interface python-can with last version(~4.2.2), and it worked in same code.
To Reproduce
Below line added in EtasBus(can.BusABC) init at 4.3.0. It call EtasBus._apply_filters() super().__init__(channel=channel, **kwargs)
if self._oci_filters:
OCI_RemoveCANFrameFilterEx(self.rxQueue, self._oci_filters, 1)
_apply_filters got 'filters' as parameter but self._oci_filters is checked.
self._oci_filters is defined after calling _apply_filters in EtasBus init.
Expected behavior
Im not sure how self._oci_filters will be working in EtasBus. I think self._oci_filters could be defined before EtasBus.init
Additional context
OS and version: Windows 10 x64
Python version: 3.10.8
python-can version: 4.3.0
python-can interface/s (if applicable): etas
Activity
zariiii9003 commentedon Nov 20, 2023
Could you try moving this line
python-can/can/interfaces/etas/__init__.py
Line 21 in bc3f955
to the end of the
__init__method?zariiii9003 commentedon Dec 5, 2023
@lumagi You have ETAS interfaces, right? Could you try the fix?
lumagi commentedon Dec 5, 2023
Yes, I can try the fix, probably tomorrow. Do I understand correctly, this is a regression from the 4.3.0 release?
zariiii9003 commentedon Dec 5, 2023
Yep, i think from #1532
lumagi commentedon Dec 6, 2023
That's unfortunate, especially since it's my PR :-/
I didn't get around to testing it today, but I have it on my plate for tomorrow.
Fix initialization order in EtasBus
lumagi commentedon Dec 7, 2023
@zariiii9003 I was able to verify the bug and validate the fix today, see #1704.
Fix initialization order in EtasBus (#1704)