bmcfee / presets

A python module to manipulate default parameters of a module's functions
ISC License
3 stars 1 forks source link

Python 3.5 built-in module exception #9

Closed bmcfee closed 7 years ago

bmcfee commented 7 years ago
In [7]: librosa = Preset(_librosa)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-f50f34fc9f9e> in <module>()
----> 1 librosa = Preset(_librosa)

/home/bmcfee/git/presets/presets/__init__.py in __init__(self, module, dispatch, defaults)
    132                         self._dispatch[value] = Preset(value,
    133                                                        dispatch=self._dispatch,
--> 134                                                        defaults=self._defaults)
    135 
    136                     setattr(self, attr, self._dispatch[value])

/home/bmcfee/git/presets/presets/__init__.py in __init__(self, module, dispatch, defaults)
    122             elif isinstance(value, types.ModuleType):
    123                 # test if this is a submodule of the current module
--> 124                 submodpath = inspect.getfile(value)
    125 
    126                 if os.path.commonprefix([modpath, submodpath]) == modpath:

/home/bmcfee/miniconda/envs/py35/lib/python3.5/inspect.py in getfile(object)
    604         if hasattr(object, '__file__'):
    605             return object.__file__
--> 606         raise TypeError('{!r} is a built-in module'.format(object))
    607     if isclass(object):
    608         if hasattr(object, '__module__'):

TypeError: <module 'sys' (built-in)> is a built-in module