CAN_initialize failing after 'Stop Debugging' in python

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
klaus2
Posts: 5
Joined: Tue 4. Sep 2018, 07:21

CAN_initialize failing after 'Stop Debugging' in python

Post by klaus2 » Mon 1. Oct 2018, 10:30

Hi
As isee this problem also occurs in visual studio (see here https://www.peak-system.com/forum/viewt ... =41&t=2697)
Is there any solution to this in python? I am using pycharm as IDE.
This is some how a show stopper as I need to restart the IDE each time.
Any solution?
Thx

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: CAN_initialize failing after 'Stop Debugging' in python

Post by M.Maidhof » Mon 1. Oct 2018, 17:29

Hi,

which version of the PCANBasic.dll do you use?

regards

Michael

klaus2
Posts: 5
Joined: Tue 4. Sep 2018, 07:21

Re: CAN_initialize failing after 'Stop Debugging' in python

Post by klaus2 » Mon 1. Oct 2018, 19:05

Hi
I installed every Thing from the DVD which came With the pcan USB. Where so i See the version?

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: CAN_initialize failing after 'Stop Debugging' in python

Post by M.Maidhof » Tue 2. Oct 2018, 09:30

When installing through our PeakOemDrv.exe setup, you will find the files in the Windows\system32 (64bit version) and Windows\syswow64 (32bit version) directory. Simply check the properties of both PCANBasic.dll files, to see the file version.

klaus2
Posts: 5
Joined: Tue 4. Sep 2018, 07:21

Re: CAN_initialize failing after 'Stop Debugging' in python

Post by klaus2 » Tue 2. Oct 2018, 11:08

Thanks for the quick response.
I have version 4.3.0.150

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

Re: CAN_initialize failing after 'Stop Debugging' in python

Post by K.Wagner » Thu 4. Oct 2018, 10:24

Hello,
klaus2 wrote: I am using pycharm as IDE.
We don't use the IDE you mentioned (PyCharm), though we have installed it for testing and we think, it also retains the debugging process in background as Visual Studio does. When using the python console within PyCharm, the connection to PCANBasic is reset each time the console is stopped or restarted
Python Console
Python Console
PyCharm.PNG (23.61 KiB) Viewed 5268 times
Though, if you just close the console, then the problem appears (without clicking stop or restart button).
klaus2 wrote:Is there any solution to this in python?
please note that this problem doesn't occur when using the Python compiler and its own IDE. This problem is caused by features and enhancements of other IDEs like this you are using. We cannot see any configuration on PyCharm to avoid this behavior. Please look for a PyCharm forum and ask how to do this.

Note: PCAN-Basic main condition is "one connection per process". As long as a PCAN-Basic channel is being used, and this is an active (valid) and working process, no other process can access the channel. You have to ensure that the debugging process is terminated, or that you call CAN_Uninitialize on the channel before terminating the debug-session. We cannot change this behavior within PCAN-Basic.
Best regards,
Keneth

Post Reply