Python fails to “from pcan.PCANBasic import *”
Python fails to “from pcan.PCANBasic import *”
I have seen a number of posts about this topic, and I believe I have tried everything that was suggested, but I cannot get this pcan.PCANBasic import to work.
I have tried:
• Installed latest PEAK-System_Driver-Setup
• Verified 64bit DLL in System32 and 32bit in SysWow64
• Tried copying each PCANBasic.DLL to local directory.
Should there be an explicit PATH statement with “pcan” in it?
Any other steps to isolate the problem?
Thanks,
Jim
I have tried:
• Installed latest PEAK-System_Driver-Setup
• Verified 64bit DLL in System32 and 32bit in SysWow64
• Tried copying each PCANBasic.DLL to local directory.
Should there be an explicit PATH statement with “pcan” in it?
Any other steps to isolate the problem?
Thanks,
Jim
-
- Sales & Support
- Posts: 1060
- Joined: Fri 20. Sep 2019, 13:31
Re: Python fails to “from pcan.PCANBasic import *”
Hello,
Is the header file "PcanBasic.py" present?
BR
Marvin
Is the header file "PcanBasic.py" present?
BR
Marvin
---
Marvin Heidemann
PEAK-Support Team
Marvin Heidemann
PEAK-Support Team
Re: Python fails to “from pcan.PCANBasic import *”
Yes, I have everything in one directory, including the PCANBasic.py.
Jim
Jim
-
- Sales & Support
- Posts: 1060
- Joined: Fri 20. Sep 2019, 13:31
Re: Python fails to “from pcan.PCANBasic import *”
Hello,
Can you share part of your code, especially the imports?
Can you share part of your code, especially the imports?
---
Marvin Heidemann
PEAK-Support Team
Marvin Heidemann
PEAK-Support Team
Re: Python fails to “from pcan.PCANBasic import *”
Yes, it is the start of the python file:
And it fails on the pcan.PCANBasic import line
Code: Select all
try:
from tqdm import tqdm
from pcan.PCANBasic import *
import ctypes
except ImportError:
print('[ERROR] Dependant modules not available of PCANBasic.')
print('')
sys.exit()
Last edited by K.Wagner on Tue 28. Jan 2025, 10:59, edited 1 time in total.
Reason: Code formatted for better reading
Reason: Code formatted for better reading
Re: Python fails to “from pcan.PCANBasic import *”
Hello,
if you have the drivers and PCAN-Basic installed (PEAK-Drivers Setup), and also Python, then you should be able to load and use the library. It could be a problem with environment configuration in Pyhton itself. Which Python version are you using? which OS are you using?
In normal cases, you should be able:
if you have the drivers and PCAN-Basic installed (PEAK-Drivers Setup), and also Python, then you should be able to load and use the library. It could be a problem with environment configuration in Pyhton itself. Which Python version are you using? which OS are you using?
In normal cases, you should be able:
- to compile and launch the Pyhton samples contained in the PCAN-Basic package (console and GUI. The last one uses tkinter).
- to load the PCANBasic.py module with Python IDLE and run it. Over the console then directly call the API functions.
Best regards,
Keneth
Keneth
Re: Python fails to “from pcan.PCANBasic import *”
Keneth,
Thank you for your help on this. I am not a Python-guy, but your examples were key. Your examples imported the library via "from PCANBasic import *", but the example code I got from the microprocessor company was "from pcan.PCANBasic import *". I don't know the ramifications of the difference, but your line does not exception.
Thanks,
Jim
Thank you for your help on this. I am not a Python-guy, but your examples were key. Your examples imported the library via "from PCANBasic import *", but the example code I got from the microprocessor company was "from pcan.PCANBasic import *". I don't know the ramifications of the difference, but your line does not exception.
Thanks,
Jim
Re: Python fails to “from pcan.PCANBasic import *”
Hello,
OK. I missed the incorrect import in your code.
Thanks for the feedback.
Closed.
OK. I missed the incorrect import in your code.
Thanks for the feedback.
Closed.
Best regards,
Keneth
Keneth