Open SofiaGR opened 6 years ago
Hi @SofiaGR
What is your python version. I made the tests with version 2.7 as far as I remember.
But it is very strange ... can you check if you have the file /lib/common/config.py
?
KR
Hello @normyx
I'm using python 3.5.3 with opencv 3.3.1.
And I don't have a config.py file in the common folder, besides commonconfig.py. The config file it can't locate is in the /lib/tools. Should it be in lib/common/?
Hi
Sorry, I had a wrong analyze. Could you please make a test with python 2.7 ?
Do you have the file config.py
in lib/tools/
?
Hello @normyx
At the moment, I only have Opencv built for python 3.5.3. I can compile it for python 2.7 and see how it goes.
The file config.py is in that folder however, but it can't seem to find it. :/
Can you try to put up the import line from config import ToolsConfig
just before theimport cv2
?
Still the same error when I import cv2 after the config import.
Hi
Sorry, I do not see any more clue, and unfortunately I am not a python expert 🤔
Le 23 févr. 2018 19:00, "Sofia" notifications@github.com a écrit :
Still the same error when I import cv2 after the config import.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/normyx/MMM-Facial-Recognition-OCV3/issues/3#issuecomment-368089259, or mute the thread https://github.com/notifications/unsubscribe-auth/AhrZlXuLaKb4tCEeS2tRqa3siiYIRukuks5tXvyxgaJpZM4SN3Gg .
@SofiaGR, download this repository once again. Make sure you have a config.py
file in the lib/tools
folder
Hi @SofiaGR , did you solve your issue (to clore that thread)?
Going to try downloading this repository again. Couldn't do anything during the weekend since the raspberry was at work.
I downloaded the repository again and verified I do have the config.py
file in the lib/tools
folder.
The error remains the same.
You worked on this using python 2.7 and Opencv 3+ right?
So I can only assume the issue derives from me using python 3.5.3.
Importing a file in Python3 is different. In Python 3 all imports are absolute unless a relative path is given to perform the import from. You will either need to use an absolute or relative import.
In line 19
of capture.py
(lib/tools/capture.py), change it to
from .config import ToolsConfig
Annnd just like that it's fixed ^^; I knew it was something related to python 3
Thank you @inderpartap for your help!
And of course thanks as well @normyx :) It appears to be working now o/
Feel free to close this :D
Hi all,
thank you very much. @inderpartap : Do you know how to import in a way to be compatible for python 2.7 and 3.0 ?
Regards
Hey @normyx. Giving a relative path for the file is compatible with both Python 2.x and 3.x. You can change line 19 in capture.py
permanently to - from .config import ToolsConfig
. It should work on both the versions without any errors.
Thx, I will try before closing the issue.
@normyx Any updates?
Not yet, no time for this right now ;o)
install Python 2.7 and everything will work fine, python3 pop up errors for me on Pi3, but same code run smooth on 2.7, just follow the instruction as given
No update. No time to update and check with Python 3.X ... sorry !
Hello @normyx ,
I recently found this module and installed all the requirements successfully. However, when I run the command
python tools.capture.py
I always run into the error
Do you have any clues what I might be missing?
Thanks!