반응형
Django 프로젝트, 앱 생성시 아래와 같은 에러가 발생할 경우
File "C:\Python27\Lib\functools.py", line 56, in <lambda>
'__lt__': [('__gt__', lambda self, other: other < self),
RuntimeError: maximum recursion depth exceeded while calling a Python object
C:\Python27\Lib\functools.py 에 Convert 부분을 다음과 같이 변경해 주면 된다.
def total_ordering(cls):
"""Class decorator that fills in missing ordering methods"""
# convert = {
# '__lt__': [('__gt__', lambda self, other: other < self),
# ('__le__', lambda self, other: not other < self),
# ('__ge__', lambda self, other: not self < other)],
# '__le__': [('__ge__', lambda self, other: other <= self),
# ('__lt__', lambda self, other: not other <= self),
# ('__gt__', lambda self, other: not self <= other)],
# '__gt__': [('__lt__', lambda self, other: other > self),
# ('__ge__', lambda self, other: not other > self),
# ('__le__', lambda self, other: not self > other)],
# '__ge__': [('__le__', lambda self, other: other >= self),
# ('__gt__', lambda self, other: not other >= self),
# ('__lt__', lambda self, other: not self >= other)]
# }
convert = {
'__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),
('__le__', lambda self, other: self < other or self == other),
('__ge__', lambda self, other: not self < other)],
'__le__': [('__ge__', lambda self, other: not self <= other or self == other),
('__lt__', lambda self, other: self <= other and not self == other),
('__gt__', lambda self, other: not self <= other)],
'__gt__': [('__lt__', lambda self, other: not (self > other or self == other)),
('__ge__', lambda self, other: self > other or self == other),
('__le__', lambda self, other: not self > other)],
'__ge__': [('__le__', lambda self, other: (not self >= other) or self == other),
('__gt__', lambda self, other: self >= other and not self == other),
('__lt__', lambda self, other: not self >= other)]
}
반응형
'Python > Django' 카테고리의 다른 글
[Python][Django] settings.py 의 템플릿 로딩 API (0) | 2019.01.08 |
---|---|
[Python][Django] Template Tag < For > (0) | 2019.01.07 |
[Python][Django] TypeError : ~ is not JSON serializable 해결 방법 (0) | 2019.01.03 |
Windows Apache 설정 (0) | 2018.03.16 |
[Django][orm] Date format (0) | 2018.01.22 |