-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimportmodules.py
More file actions
37 lines (30 loc) · 1.01 KB
/
importmodules.py
File metadata and controls
37 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
#---------------------
# Talwar v 0.2
# Import Modules
#---------------------
#Import Modules
import glob
import sys
#Internal Imports
from db_config import default_db
#Default Variable
# Start Import Modules
def start_importmodules():
module_table=default_db('modules')
try:
for module in glob.iglob('./Modules/*.py'):
try:
mod_name=module.split('/')[2].split('.')[0]
sys.path.append('Modules/')
mod=__import__(mod_name)
try:
config=mod.config_talwar()
module_table.insert({'mod_name': module.split('/')[2].split('.')[0], 'inputsint': len(config['inputs']),'outputsint': len(config['outputs']),'inputs': str(list(config['inputs'])),'outputs': str(list(config['outputs']))})
print '[#]'+mod_name+' imported!'
except:
print '[!]Unable to Configure the module'
except:
print '[!]Unable to find the default functions for Talwar imports in ' + module.split('/')[2].split('.')[0] + ' module.'
except:
print '[!]Some problem with importing modules'