I'm trying to use the following function defined in gerencia/alert/views.py
def maLogger(level, message, node=None):
aux=0
if level=='Critical_client':
aux=2
date = datetime.datetime.now()
log = Log(level=level, date=date, node=node, message=message, flood=aux)
log.save()
I've tried calling it from the file mad_weka.py
but it does not import
[wilker@centos7 gerencia]$ python
Python 2.7.5 (default, Sep 15 2016, 22:37:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from mad_weka import Mad
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mad_weka.py", line 7, in <module>
from gerencia.alert.views import maLogger
ImportError: No module named gerencia.alert.views
Below is the directory tree
[wilker@centos7 MeshAdmin]$ tree
.
├── gerencia
│ ├── alert
│ │ ├── __init__.py
│ │ ├── __init__.pyc
│ │ ├── models.py
│ │ ├── models.pyc
│ │ ├── tests.py
│ │ ├── urls.py
│ │ ├── urls.pyc
│ │ ├── views.py
│ │ └── views.pyc
│ ├── mad_weka.py
│ ├── mad_weka.pyc
│ ├── manage.py
│ ├── mad
│ │ ├── admin.py
│ │ ├── admin.pyc
│ │ ├── __init__.py
│ │ ├── __init__.pyc
│ │ ├── mad_weka.pyc
│ │ ├── models.py
│ │ ├── models.pyc
│ │ ├── tests.py
│ │ └── views.py
Even though I put it in the /mad
directory or in the /alert
itself, I get the same error. What do I need to do for Python see the file views.py
?
Follow the pastebin link with the complete directory tree.