I'm trying use zbar on RPI3 but i have a problem. I dont have ImageScanner, Image... module.
import zbar
scanner = zbar.ImageScanner()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'ImageScanner'
I tried to install it from pip, official repository, some fork, but nothing work.
https://pastebin.com/ajbWdSct
how can i access image modul?
To list module content try to type:
import zbar
dir(zbar)
See example are in source https://github.com/npinchot/zbar/blob/master/examples/read_one.py
Related
I am trying to make face recognition script in python with the help of below given link found on google.
https://www.mygreatlearning.com/blog/face-recognition/
I have installed:
OpenCV
dlib and
face_recognition
libraries.
Also, installed Visual C++ for CMake.
And now I am trying to "extract features from Face" using code given in above link.
While running script, I am getting below error:
Traceback (most recent call last):
File "C:\Users\ajay.arora2\AppData\Local\Programs\Python\Python38-32\extract_features_from_face.py", line 2, in <module>
import face_recognition
File "C:\Users\ajay.arora2\AppData\Local\Programs\Python\Python38-32\face_recognition.py", line 32, in <module>
encodings = face_recognition.face_encodings(rgb)
AttributeError: partially initialized module 'face_recognition' has no attribute 'face_encodings' (most likely due to a circular import)
I have tried re-installing face_recognition module.
Please suggest any workaround.
Thanks in advance.
Most probably you have named your file the same as the library "face_recognition".
Circular import happens when you want to import something from the same file.
From this question in SO I understand the error should be solved by having opencv contrib, but the thing is that when I first built opencv using cmake using this guide by pyimagesearch , I had also built opencvcontrib. If I must rebuild it, how exactly should I do it?
This is the error:
import cv2
cv2.createLBPHFaceRecognizer()
Traceback (most recent call last):
File "stdin", line 1, in module
AttributeError: 'module' object has no attribute 'createLBPHFaceRecognizer'
Also:
import cv2
help(cv2.face.createLBPHFaceRecognizer)
Traceback (most recent call last):
File "stdin", line 1, in module
AttributeError: 'module' object has no attribute 'face'
Mac OS, Python 2.7, Opencv 3.2
After searching high and low, I found that using cv2.face.LBPHFaceRecognizer_create() just do the trick for opencv 3.3.0 with opencv contrib. Hope you find it useful.
createLBPHFaceRecognizer() is in the sub-module cv2.face in python. To access it you should use cv2.face.createLBPHFaceRecognizer().
I have executed this command: pip install opencv-contrib-python
it has install opencv version : 3.4.0,
and it works with this formula:
import cv2
recognizer = cv2.face.LBPHFaceRecognizer_create()
I'm trying to install Ansible, but I can never get a clean install for some reason. using apt-get install ansible and then doing a ansible --version I get the following output:
Traceback (most recent call last):
File "/usr/bin/ansible", line 44, in <module>
import ansible.constants as C
File "/usr/lib/python2.7/dist-packages/ansible/constants.py", line 26, in <module>
from ansible.compat.six import string_types
File "/usr/lib/python2.7/dist-packages/ansible/compat/six/__init__.py", line 40, in <module>
not hasattr(_system_six.moves, 'shlex_quote') or
AttributeError: 'module' object has no attribute 'moves'
Ansible is still very young and OS packaging is lagging behind. Although this particular error may simply be caused by a version mismatch or missing dependency.
May I suggest running Ansible from source?
I Just attempted to install tensorflow for python and when I went to the console to see if the init.py was working it returned this error. I installed it manualy without pip or any other package manager.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\*username\AppData\Local\Programs\Python\Python35-32\lib\tensorflow\__init__.py", line 43, in <module>
_default_dlopen_flags = sys.getdlopenflags()
AttributeError: module 'sys' has no attribute 'getdlopenflags'
TensorFlow is not supported on Windows yet. Please follow this github issue which tracks TensorFlow Windows support.
I have lately installed python-git package, and when trying to follow the tutorials over at the following link, I find that certain methods are missing...
http://packages.python.org/GitPython/0.3.2/tutorial.html#tutorial-label
Here is what came out of my interpreter:
>>> from git import *
>>> repo = Repo.init('/home/deostroll/scripts/synchost')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'Repo' has no attribute 'init'
>>> repo = Repo('/home/deostroll/scripts/synchost')
>>> repo.is_dirty()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'bool' object is not callable
>>>
Those commands work for me, so I agree with the other answer that you're probably using an outdated version. If you're on linux and have PIP, installed, on the command line you can do:
pip install --upgrade GitPython
to upgrade to the latest version. (Sidenote: for me on Fedora, the command is actually pip-python, so it depends on your distro).
It seems likely that you're using a very outdated verison of GitPython. In version 0.3, is_dirty is a method, and init exists.
In version 0.1, is_dirty is a property, and init_bare is defined, but not init.