Django RuntimeError: maximum recursion depth exceeded

后端 未结 3 1217
名媛妹妹
名媛妹妹 2020-12-19 22:20

I\'m new to Django. I installed Django using easy_install (on a Mac) and PyDev Django plugin for eclipse. I followed standard procedures to create a new PyDev Django project

相关标签:
3条回答
  • 2020-12-19 22:49

    I've run into this a couple times while using pyenv virtualenvs with python 2.7.1. I didn't want to edit core files so I upgraded to 2.7.5 and it worked flawlessly. Hopefully this is an option for some of you.

    0 讨论(0)
  • 2020-12-19 22:55

    I removed PyDev, Django and Python and re-installed all of them, and now it works. Thanks!

    0 讨论(0)
  • 2020-12-19 23:00

    The problem is in functools.py file. This file is from Python.

    To fix the problem replace this (about line 56 in python\Lib\fuctools.py):

        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)]
    }
    

    to that:

        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)]
    }
    

    Read also: http://regebro.wordpress.com/2010/12/13/python-implementing-rich-comparison-the-correct-way/

    0 讨论(0)
提交回复
热议问题