-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"sys.path.insert" error #19
Comments
I have the same issue here and can't solve it too, so have you found any solution to that? |
To make it work I needed to change it like this:
|
Almost the same error after the editing !! could you help me with that? |
Are you building the library with make? Check if you have the .so file in the bin folder... This is the only idea I have |
I didn't find the .so file in bin folder although I have made all the steps mentioned in the post, so do you have any idea how to add this file and solve this problem? |
You need to be sure the make command is running correctly and the file should be created automatically. I never worked with ctypes thus I do not know more than this. Make is compiling the library from c code into the .so file. You may look around for more info about make... Maybe you can change some options or enable some logging... Not sure though |
Ok, thank you for your help. |
Thanks! I had issues using this package as a subfolder in my program. My executing main is two folders above this package folder. By adjusting the VL53L0X.py with your settings it works |
I tried the solution mentioned above but that didnt work for me (NanoPi Neo) so i put the explicit path into line 67:
and this seemed to work however i now get the following issue:
solved it by switching to another sensor.. |
I tried to load the library by using
sys.path.insert
but there was an error at runtime:File "main.py", line 6, in <module> import VL53L0X
File "/home/pi/*MyPath*/lib/VL53L0X_rasp_python/python/VL53L0X.py", line 68, in <module> tof_lib = CDLL("../bin/vl53l0x_python.so")
File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__ self._handle = _dlopen(self._name, mode)
OSError: ../bin/vl53l0x_python.so: cannot open shared object file: No such file or directory
I tried to add the path to the libraries environment variable and other things but I was not able to fix it.
I did find a workaround by changing the
VL53L0X.py
library file like this on line 67:# Load VL53L0X shared lib
import os
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, "../bin/vl53l0x_python.so")
tof_lib = CDLL(filename)
I've never worked/used ctypes and I'm sure this is not the best solution but I cannot understand if I'm doing something wrong or if it is really a library issue.
The text was updated successfully, but these errors were encountered: