PCANBasicExample_py3.pyw freeze initialization when CANFD with Python3 , have solution.

This forum covers PCAN-Linux and Linux development issues concerning our products
Locked
Pe3ucTop
Posts: 3
Joined: Fri 13. Mar 2020, 10:08

PCANBasicExample_py3.pyw freeze initialization when CANFD with Python3 , have solution.

Post by Pe3ucTop » Fri 13. Mar 2020, 10:48

Hello PEAK-Systems.

I tried to use Python3 PCANBasic Example and find it freeze at Initialize when CAN-FD is selected.
I do a bit research and find that problem is in initialization Bitrate string.
In python3 all string are unicode, but to c_dll need pass bytestring, so line:

Code: Select all

result =  self.m_objPCANBasic.InitializeFD(self.m_PcanHandle, self.m_BitrateTXT.get())
need be replaced to

Code: Select all

result =  self.m_objPCANBasic.InitializeFD(self.m_PcanHandle, self.m_BitrateTXT.get().encode())
there could be other similar problems if strings are passed to "c" functions from python3 .
Please update example.

K.Wagner
Software Development
Software Development
Posts: 1082
Joined: Wed 22. Sep 2010, 13:36

Re: PCANBasicExample_py3.pyw freeze initialization when CANFD with Python3 , have solution.

Post by K.Wagner » Fri 13. Mar 2020, 11:18

Hello,

this a known issue that we have already fixed. This will be delivered with the next release of PCAN-Basic
Best regards,
Keneth

Locked