I want to understand how does Python search for files using its search path. I have the following error:
Traceback (most recent call last):
File "C:\Users\Rusk\Desktop\BBone_RTL-SDR\codes\lab6.py", line 9, in <module>
import rtlsdr
File "C:\Program Files (x86)\Python3.5\lib\site-packages\rtlsdr\__init__.py", line 50, in <module>
from .librtlsdr import librtlsdr
File "C:\Program Files (x86)\Python3.5\lib\site-packages\rtlsdr\librtlsdr.py", line 41, in <module>
librtlsdr = load_librtlsdr()
File "C:\Program Files (x86)\Python3.5\lib\site-packages\rtlsdr\librtlsdr.py", line 36, in load_librtlsdr
raise ImportError('Error loading librtlsdr. Make sure librtlsdr '\
ImportError: Error loading librtlsdr. Make sure librtlsdr (and all of its dependencies) are in your path
I have verified that all of the modules and dependencies have been installed using pip. Ihe function of load_lbrtlsdr() is as such:
def load_librtlsdr():
driver_files = ['rtlsdr.dll', 'librtlsdr.so']
driver_files += ['..//rtlsdr.dll', '..//librtlsdr.so']
driver_files += ['rtlsdr//rtlsdr.dll', 'rtlsdr//librtlsdr.so']
driver_files += [find_library('rtlsdr'), find_library('librtlsdr')]
dll = None
for driver in driver_files:
try:
dll = CDLL(driver)
break
except:
pass
else:
raise ImportError('Error loading librtlsdr. Make sure librtlsdr '\
'(and all of its dependencies) are in your path')
return dll
It seems that the reason i encountered this error was because the program failed to locate the driver (.dll) which is located in my main desktop screen. I had edited the environment variable to include the path to the location of the driver but the error persists. I have been stuck trying to find alternatives but nothing seems to work. Could someone kindly elp me out or direct me towards some direction? Thanks! I am just 5 days old with Python. I am using a 64-bit windows OS by the way.