Page 1 of 1

Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python

Posted: Tue 2. May 2023, 08:36
by Godel
Hi all,

I am trying to wrap PCAN-ISO-TP.dll (ver 3.4) into LabVIEW VIs on the Win10 environment.
There is a language construct called "call library function node" in LabVIEW responsible for loading and interfacing dll.
The "call library function node" fails to load PCAN-ISO-TP.dll (ver 3.4) but succeeds to load PCAN-ISO-TP.dll (ver 2.2).
The PCANBasic.dll, the dependency of PCAN-ISO-TP.dll, is placed in the same folder.

Then, I executes the Python sample code "07_classic_can_read_write" (Python 3.10.11 64bit interpreter) on Visual Studio Code.
The same thing happened.
Ver 3.4 fails to initialization, but initialization of Ver 2.2 is ok.
Fail to Initialize PCAN-ISO-TP.dll (ver 3.4).png
Fail to Initialize PCAN-ISO-TP.dll (ver 3.4).png (333.93 KiB) Viewed 5800 times
The PCAN-ISO-TP.dll (ver 3.4) and PCANBasic are put inside System32.
I also tried to put them inside a local folder and invoked them from the local folder, but everything is the same.

Any suggestion on or further experiment for resolving this problem?

Thank you for any help you can provide.

Godel

Re: Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python

Posted: Tue 2. May 2023, 08:57
by K.Wagner
Hello,

we do not work with LabVIEW so we cannot give much help on this, but it seems like you may be mixing the x86 and x64 bit libraries. As you are using Python 64-Bit, then you should assert that you are using the x64 version of the dlls (PCAN-ISO-TP.dll and PCANBasic.dll). You can see this by showing the details of the file properties on the dlls. In the decription of the file you will see if it is the x86 or x64 version.

Re: Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python

Posted: Tue 2. May 2023, 09:14
by Godel
Hi Wagner,

I am quite sure that the two x64 version dlls (PCAN-ISO-TP.dll (ver3.4) and PCAN-Basic.dll (ver4.3)) are put inside System32.
And Python fails to initialization.

Godel

Re: Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python

Posted: Tue 2. May 2023, 11:51
by K.Wagner
Hello,

please note that the current version of PCAN-ISO-TP offers support for Python v2.7 and v3.8.
PCAN-ISO_TP_Python.PNG
PCAN-ISO_TP_Python.PNG (9.5 KiB) Viewed 5791 times
Please try with a version of Python equals or older than v3.8.

Re: Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python

Posted: Wed 3. May 2023, 04:56
by Godel
Hi,

Testing on Python 3.8.10 64bit, and result is the same. (Antivirus is turned off.)
Test on Python 3.8.10 64bit.png
Test on Python 3.8.10 64bit.png (274.83 KiB) Viewed 5780 times

Re: Fail to initialization PCAN-ISO-TP.dll (ver 3.4) in Python

Posted: Wed 3. May 2023, 13:55
by K.Wagner
Hello again,

we have tested the PCAN-ISO-TP example "07_classic_can_read_write" on a clean Windows 11 PC, using the latest PCAN-ISO-TP and having installed the latest device drivers and PCAN-Basic API (using the PEAK-Drivers Setup) and also installed the latest Python version, v3.11.3, and with some adjusment we were able to successfully run the sample.

First of all, it seems there is a change in the way how external library paths are resolved, beginning with Python v3.8, as described in the article "DLL not found after switching from Python 3.7.6 to Python 3.10.3" from stackoverflow. Moreover, a new function was included to handle with library paths, os.add_dll_directory. The help of it states:
.
DLL_Loading.PNG
DLL_Loading.PNG (37.1 KiB) Viewed 5769 times

The sample ran by removing the PCAN-ISO-TP.dll from the project folder and copying it into the WIndows\System32 folder. Note that the PEAK-Drivers Setup also copies the needed PCAN-Basic.dll into this folder. Having these two libraries in this folder the sample application works as expected.

You mentioned alraedy, that you are copying the files in the WIndows\System32 folder, so this workaround may not work for you, and you may be experimenting a different or additional problem we are not aware of. Unfortunatelly, we cannot reproduce this. Do you have the possibility to test this using a different PC?