IPython-Dashboard
IPython-Dashboard copied to clipboard
Cannot import dashboard as dash, NoSectionError: No section: 'formatters'
I am unable to import "dashboard" and get the code running:
import dashboard as dash
NoSectionError Traceback (most recent call last)
/home/jdargent/.local/lib/python2.7/site-packages/dashboard/init.py in
/home/jdargent/.local/lib/python2.7/site-packages/dashboard/conf/config.py in
/home/jdargent/.local/lib/python2.7/site-packages/dashboard/conf/config.py in config_log() 33 import logging.config 34 from ..server.utils import Map ---> 35 logging.config.fileConfig('dashboard/conf/logging.conf') 36 access_log = logging.getLogger('access') 37 error_log = logging.getLogger('error')
/usr/lib/python2.7/logging/config.pyc in fileConfig(fname, defaults, disable_existing_loggers) 75 cp.read(fname) 76 ---> 77 formatters = _create_formatters(cp) 78 79 # critical section
/usr/lib/python2.7/logging/config.pyc in _create_formatters(cp) 111 def _create_formatters(cp): 112 """Create and return formatters""" --> 113 flist = cp.get("formatters", "keys") 114 if not len(flist): 115 return {}
/usr/lib/python2.7/ConfigParser.pyc in get(self, section, option, raw, vars) 605 except KeyError: 606 if section != DEFAULTSECT: --> 607 raise NoSectionError(section) 608 # Update with the entry specific variables 609 vardict = {}
NoSectionError: No section: 'formatters'
same error ..pls help
This is because a file named "logging.conf" miss from pypi. You could install this package from source, for my laptop Mac HighSierra(10.13.3), I run
cd ~/python_package_from_src pip install -e git+https://github.com/litaotao/IPython-Dashboard.git#egg=dashboard
However, you would run into another issue NoSectionError: No section: 'formatters'
This is due to logging.config.fileConfig use relative path
import os BASE_DIR=os.path.dirname(os.path.dirname(os.path.abspath(file))) logging.config.fileConfig(os.path.join(BASE_DIR, 'conf', 'logging.conf')) #logging.config.fileConfig('dashboard/conf/logging.conf')
Use this one should help you successfully import this dashboard module
I created a pull-request BTW. See https://github.com/litaotao/IPython-Dashboard/pull/25/commits/4dbd47ba2f366908b6bd625c97f108af90cd1315