Skip to content

Conversation

@jacobian91
Copy link
Contributor

It looks like flags_t the type was being used instead of the flags argument.

@jacobian91
Copy link
Contributor Author

This is the traceback when encountering this error:

Unable to create CAN node Traceback (most recent call last): File "...\site-packages\can\interfaces\usb2can\usb2canabstractionlayer.py", line 141, in open result = self.__m_dllBasic.CanalOpen(config_ascii, flags) │ │ └ <class 'ctypes.c_ulong'> │ └ b'F8BAFED8; 500'<can.interfaces.usb2can.usb2canabstractionlayer.Usb2CanAbstractionLayer object at 0x0000020F03E5D370> ctypes.ArgumentError: argument 2: <class 'TypeError'>: Don't know how to convert parameter 2

super().__init__(
channel=channel, dll=dll, flags_t=flags_t, bitrate=bitrate, *args, **kwargs
channel=channel, dll=dll, flags=flags, bitrate=bitrate, *args, **kwargs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since BusABC does not know these, we can also ignore them here.

Suggested change
channel=channel, dll=dll, flags=flags, bitrate=bitrate, *args, **kwargs
channel=channel, bitrate=bitrate, *args, **kwargs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also removed bitrate as it looks like BusABC doesn't use this either, so now this line is super().__init__(channel=channel, **kwargs).
I've removed the *args as well to prevent errors from positional vs keyword argument ordering. the BusABC argument can_filters could get passed into Usb2canBus via kwargs.

@felixdivo felixdivo added this to the 4.0.0 Release milestone Feb 6, 2022
@felixdivo
Copy link
Collaborator

Thanks @jacobian91!

@felixdivo felixdivo added the bug label Feb 6, 2022
@codecov
Copy link

codecov bot commented Feb 6, 2022

Codecov Report

Merging #1252 (1c70545) into develop (257d57d) will not change coverage.
The diff coverage is 0.00%.

@@ Coverage Diff @@ ## develop #1252 +/- ## ======================================== Coverage 65.89% 65.89% ======================================== Files 86 86 Lines 8887 8887 ======================================== Hits 5856 5856 Misses 3031 3031 
dll="usb2can.dll",
flags=0x00000008,
*args,
*_,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional style change, this documents that all additional positional arguments get ignored but won't throw an exception when passed in.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's fine. We don't have a unified handling of that case anyways.

@felixdivo felixdivo requested a review from hardbyte February 9, 2022 10:19
@felixdivo felixdivo merged commit 20b3138 into hardbyte:develop Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants