lithoxyl icon indicating copy to clipboard operation
lithoxyl copied to clipboard

TypeError: unhashable type: 'Level'

Open adaszko opened this issue 7 years ago • 1 comments

Hi! I'm getting this exception during the import of lithoxyl:

In [1]: import lithoxyl
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-222423bc74ab> in <module>()
----> 1 import lithoxyl

/env/lib/python3.6/site-packages/lithoxyl/__init__.py in <module>()
      3 from lithoxyl.context import get_context, set_context
      4
----> 5 from lithoxyl.logger import Logger, DEBUG, INFO, CRITICAL
      6 from lithoxyl.emitters import StreamEmitter
      7

/env/lib/python3.6/site-packages/lithoxyl/logger.py in <module>()
     15
     16 from lithoxyl.context import get_context
---> 17 from lithoxyl.common import DEBUG, INFO, CRITICAL
     18 from lithoxyl.action import Action, BeginEvent, EndEvent, CommentEvent
     19

/env/lib/python3.6/site-packages/lithoxyl/common.py in <module>()
     65 LEVEL_LIST = []
     66 LEVEL_ALIAS_MAP = {}
---> 67 register_level(MIN_LEVEL)
     68 register_level(MAX_LEVEL)
     69 for level in BUILTIN_LEVELS:

/env/lib/python3.6/site-packages/lithoxyl/common.py in register_level(level_obj)
     59     LEVEL_ALIAS_MAP[level_obj.name.upper()] = level_obj
     60     LEVEL_ALIAS_MAP[level_obj._value] = level_obj
---> 61     LEVEL_ALIAS_MAP[level_obj] = level_obj
     62     LEVEL_LIST[:] = sorted(set(LEVEL_ALIAS_MAP.values()))
     63

TypeError: unhashable type: 'Level'
$ python --version
Python 3.6.4

$ pip freeze | grep lithoxyl
lithoxyl==0.4.1

adaszko avatar Feb 08 '18 09:02 adaszko

I'm trying to set up pacetrack, and I ran into this same error.

python3 pacetrack/update.py                                                                                               1456ms  Fri 07 Dec 2018 03:55:50 PM PST
Traceback (most recent call last):
  File "pacetrack/update.py", line 24, in <module>
    from log import tlog, set_debug
  File "/home/sage/play/pacetrack/pacetrack/log.py", line 3, in <module>
    from lithoxyl import Logger, SensibleSink, SensibleFormatter, StreamEmitter, SensibleFilter
  File "/home/sage/.local/lib/python3.6/site-packages/lithoxyl/__init__.py", line 5, in <module>
    from lithoxyl.logger import Logger, DEBUG, INFO, CRITICAL
  File "/home/sage/.local/lib/python3.6/site-packages/lithoxyl/logger.py", line 17, in <module>
    from lithoxyl.common import DEBUG, INFO, CRITICAL
  File "/home/sage/.local/lib/python3.6/site-packages/lithoxyl/common.py", line 67, in <module>
    register_level(MIN_LEVEL)
  File "/home/sage/.local/lib/python3.6/site-packages/lithoxyl/common.py", line 61, in register_level
    LEVEL_ALIAS_MAP[level_obj] = level_obj
TypeError: unhashable type: 'Level'

ragesoss avatar Dec 07 '18 23:12 ragesoss