Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'module' object has no attribute 'RLock'` [duplicate]

I am workin on face detection with Open CV PYTHON. my whole code was working fine yesterday and today i am getting this error.

['/usr/local/lib/python2.7/dist-packages/numpy']
 Traceback (most recent call last):
  File "facerec-opencv.py", line 2, in <module>
  from scipy.misc import imread
  File "/usr/local/lib/python2.7/dist-packages/scipy/__init__.py", line 61,in <module>
  from numpy import show_config as show_numpy_config
  File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 163, in <module>
  from . import random
  File "/usr/local/lib/python2.7/dist-packages/numpy/random/__init__.py", line 99, in <module>
  from .mtrand import *
  File "mtrand.pyx", line 149, in init mtrand (numpy/random/mtrand/mtrand.c:37623)
  File "/home/irum/Desktop/Face-Recognition/thakarrecog/threading.py", line 6, in <module>
  import logging
  File "/usr/lib/python2.7/logging/__init__.py", line 201, in <module>
    _lock = threading.RLock()
AttributeError: 'module' object has no attribute 'RLock'

i have tried updating numpy also i reinstall it but nothong is workin.

like image 534
Irum Zahra Awan Avatar asked Dec 07 '16 07:12

Irum Zahra Awan


People also ask

How do I fix Python module has no attribute?

To solve the Python "AttributeError: module has no attribute", make sure you haven't named your local modules with names of remote modules, e.g. datetime.py or requests.py and remove any circular dependencies in import statements.

What does object has no attribute mean in Python?

It's simply because there is no attribute with the name you called, for that Object. This means that you got the error when the "module" does not contain the method you are calling.


Video Answer


1 Answers

If it helps someone, I had the exact same problem. Code running till one day and then suddenly this error. What had changed was that I had made a file called threading.py in the same directory. Threading is a also a library name. Which created conflicts and all code was breaking. Just removing threading.py solved it for me.

like image 132
Anirudh Gupta Avatar answered Jan 03 '23 22:01

Anirudh Gupta