IPython-Dashboard icon indicating copy to clipboard operation
IPython-Dashboard copied to clipboard

Cannot import dashboard as dash, NoSectionError: No section: 'formatters'

Open jdargent opened this issue 8 years ago • 3 comments
trafficstars

I am unable to import "dashboard" and get the code running:

import dashboard as dash

NoSectionError Traceback (most recent call last) in () 7 8 # third-parth package ----> 9 import dashboard as dash 10 import pandas as pd 11 import matplotlib as plt

/home/jdargent/.local/lib/python2.7/site-packages/dashboard/init.py in () 11 12 # user-defined package ---> 13 from .conf import config 14 15

/home/jdargent/.local/lib/python2.7/site-packages/dashboard/conf/config.py in () 42 43 return logger ---> 44 logger = config_log() 45 46 # env config

/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'

jdargent avatar Feb 13 '17 17:02 jdargent

same error ..pls help

getsantanupathak avatar May 15 '17 08:05 getsantanupathak

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

whossa avatar Sep 05 '18 11:09 whossa

I created a pull-request BTW. See https://github.com/litaotao/IPython-Dashboard/pull/25/commits/4dbd47ba2f366908b6bd625c97f108af90cd1315

whossa avatar Sep 05 '18 11:09 whossa