Developing for Splunk Enterprise
Highlighted

Splunk webservice won't start due to Python error?

Path Finder

I recently installed Splunk on my Windows machine and the process completed. However, when I try to go to the splunk web interface, I am unable to connect. Searching the webservice log provides the following issues. It seems to by Python related, but I am not sure what these errors mean.

2016-03-26 12:09:33,671 ERROR   [-] root:810 - Unable to start splunkweb
2016-03-26 12:09:33,673 ERROR   [-] root:811 - must be string without null bytes or None, not str
Traceback (most recent call last):
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\splunk\appserver\mrsparkle\root.py", line 90, in <module>
    splunk.setupSplunkLogger(logger, LOGGING_DEFAULT_CONFIG_FILE, LOGGING_LOCAL_CONFIG_FILE, LOGGING_STANZA_NAME)
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\splunk\__init__.py", line 149, in setupSplunkLogger
    levels = getSplunkLoggingConfig(baseLogger, defaultConfigFile, localConfigFile, loggingStanzaName, verbose)
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\splunk\__init__.py", line 168, in getSplunkLoggingConfig
    baseLogger.info('Using default logging config file: %s' % defaultConfigFile)
  File "C:\Program Files\Splunk\Python-2.7\Lib\logging\__init__.py", line 1160, in info
    self._log(INFO, msg, args, **kwargs)
  File "C:\Program Files\Splunk\Python-2.7\Lib\logging\__init__.py", line 1278, in _log
    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\splunk\appserver\mrsparkle\root.py", line 61, in makeRecord
    from splunk.appserver.mrsparkle.lib.util import get_request_id
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\splunk\appserver\mrsparkle\__init__.py", line 13, in <module>
    from lib.decorators import *
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\splunk\appserver\mrsparkle\lib\decorators.py", line 2, in <module>
    import cherrypy
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\cherrypy\__init__.py", line 161, in <module>
    from cherrypy import _cptools
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\cherrypy\_cptools.py", line 226, in <module>
    from cherrypy.lib import cptools, encoding, auth, static, tidy
  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\cherrypy\lib\static.py", line 2, in <module>
    mimetypes.init()
  File "C:\Program Files\Splunk\Python-2.7\Lib\mimetypes.py", line 351, in init
    db.read_windows_registry()
  File "C:\Program Files\Splunk\Python-2.7\Lib\mimetypes.py", line 254, in read_windows_registry
    with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: must be string without null bytes or None, not str
0 Karma
Highlighted

Re: Splunk webservice won't start due to Python error?

Path Finder

The issue ended up being in the mimestype.py.

I added the following code in line 254 of the file.

try:
                    if '\0' in subkeyname: # new
                        print "Skipping bad key: %s" % subkeyname # new
                        continue # new

File was checked with
python -m tabnanny mimestype.py

View solution in original post

0 Karma