OSError: [WinError 126] The specified module could not be found
Posted: Sat 20. Feb 2021, 17:42
I have a simple python program using PCANBasic. It fails on execution with the following:
The python program PCAN_Test.py is:
There is probably something very simple I'm doing wrong but have no idea what it is.
Thanks
Rob
Code: Select all
C:\My_Docs\...\NF_Processing\venv\Scripts\python.exe C:/My_Docs/.../NF_Processing/PCAN_Test.py
Traceback (most recent call last):
File "C:/My_Docs/.../NF_Processing/PCAN_Test.py", line 28, in <module>
objPCAN = PCANBasic()
File "C:\My_Docs\...\NF_Processing\PCANBasic.py", line 378, in __init__
self.__m_dllBasic = windll.LoadLibrary("C:\\MY Docs\\Phd\\PCAN-Basic API\\x64\\PCANBasic")
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\ctypes\__init__.py", line 442, in LoadLibrary
return self._dlltype(name)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
Process finished with exit code 1
The python program PCAN_Test.py is:
Code: Select all
import sys
#import pyodbc
import numpy as np
import pandas as pd
import random
import time
import ctypes
from ctypes import *
#from ctypes import wintypes
sys.path.append('''C:\Python34\Projects\ARM''')
sys.path.append('''C:\Python34\Lib\site-packages\python_can-1.4-py3.4.egg\can\interfaces''')
sys.path.append('''C:\My_Docs\PhD\PCAN-Basic API\x64''')
#sys.path.append('''C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib\ctypes''')
#sys.path.append(['C:\My_Docs\PhD\PCAN-Basic API\x64\'])
from PCANBasic import *
channel = PCAN_USBBUS1
#channel = PCAN_USBBUS2
baud = PCAN_BAUD_500K
timeprev = 0.0
## The Plug & Play Channel (PCAN-USB) is initialized
##
#objPCAN =# The Plug & Play Channel (PCAN-USB) is initialized
#
objPCAN = PCANBasic()
result = objPCAN.Initialize(channel, baud)
Thanks
Rob