0
I am 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 her from the archive mad_weka.py
but gives error in 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 follows 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
Although I put it in the directory /mad
or in itself /alert
, I get the same error. What I need to do for Python sees the file views.py
?
Follow the link from Pastebin with the complete directory tree.
Implemented my answer? Got it?
– Sidon
@Sidon sorry for the delay, I can only touch this project at night. I edited and put the complete tree in Stebin.
– Wilker