gallantlab / pycortex

Pycortex is a python-based toolkit for surface visualization of fMRI data
https://gallantlab.github.io/pycortex
BSD 2-Clause "Simplified" License
601 stars 139 forks source link

NoOptionError: No option 'colormaps' in section: 'webgl' #163

Open wmvanvliet opened 8 years ago

wmvanvliet commented 8 years ago

Something goes wrong when running pycortex for the first time, so without any config file. A default config file is created, but something goes wrong:

> ds = cortex.load("S1_retinotopy.hdf")
> cortex.webshow(ds)
---------------------------------------------------------------------------
NoOptionError                             Traceback (most recent call last)
<ipython-input-8-1e853b3ad5c7> in <module>()
----> 1 cortex.webshow(ds)

/data/marijn/pycortex/cortex/utils.pyc in __call__(self, *args, **kwargs)
     13 
     14     def __call__(self, *args, **kwargs):
---> 15         return self._load()(*args, **kwargs)
     16 
     17     def __getattribute__(self, name):

/data/marijn/pycortex/cortex/utils.pyc in <lambda>()
     10 class DocLoader(object):
     11     def __init__(self, func, mod, package):
---> 12         self._load = lambda: getattr(import_module(mod, package), func)
     13 
     14     def __call__(self, *args, **kwargs):

/data/marijn/miniconda/lib/python2.7/importlib/__init__.pyc in import_module(name, package)
     35             level += 1
     36         name = _resolve_name(name[level:], package, level)
---> 37     __import__(name)
     38     return sys.modules[name]

/data/marijn/pycortex/cortex/webgl/view.py in <module>()
     24 
     25 try:
---> 26     cmapdir = options.config.get('webgl', 'colormaps')
     27     if not os.path.exists(cmapdir):
     28         raise Exception("Colormap directory (%s) does not exits"%cmapdir)

/data/marijn/miniconda/lib/python2.7/site-packages/backports/configparser/__init__.pyc in get(self, section, option, **kwargs)
    801         except KeyError:
    802             if fallback is _UNSET:
--> 803                 raise NoOptionError(option, section)
    804             else:
    805                 return fallback

NoOptionError: No option 'colormaps' in section: 'webgl'
marklescroart commented 8 years ago

Hello, A short-term fix for this error is to simply add the field to the config file that the error message says is missing. You can find the config file via:

cortex.options.usercfg

In that file, there should be a heading that says

[webgl]

and under that, you should write

colormaps = /path/to/colormaps/folder/

the colormaps are originally in the source code directory (wherever you put that), in

<wherever/you/put/this>/pycortex/filestore/colormaps/

If you by any chance moved the source code directory after installing, then that could be why pycortex lost track of the colormaps directory (because it moved). However, this may just be a bug, in which case we will look into it and fix the default config file.