django startapp报 maximum recursion depth exceeded

报错截图如下:

解决办法:修改指定路径下的functools.py文件的def total_ordering(cls):方法:

原来的样子:

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

改完之后即可创建app

  

  

原文地址:https://www.cnblogs.com/phyger/p/8628821.html

时间: 2024-08-06 10:41:32

django startapp报 maximum recursion depth exceeded的相关文章

win10启动django项目报错 Django RuntimeError: maximum recursion depth exceeded

错误:Django RuntimeError: maximum recursion depth exceeded 原因出自Python\Lib\fuctools.py 把 convert = {    '__lt__': [('__gt__', lambda self, other: other < self),                ('__le__', lambda self, other: not other < self),                ('__ge__', 

Python递归报错:RuntimeError: maximum recursion depth exceeded in comparison

Python中默认的最大递归深度是989,当尝试递归第990时便出现递归深度超限的错误: RuntimeError: maximum recursion depth exceeded in comparison 简单方法是使用阶乘重现: 1 #! /usr/bin/env Python 2 3 def factorial(n): 4 5 if n == 0 or n == 1: 6 7 return 1 8 9 else: 10 11 return(n * factorial(n - 1)) >

python递归深度报错--RuntimeError: maximum recursion depth exceeded

当你的程序递归的次数超过999次的时候,就会引发RuntimeError: maximum recursion depth exceeded. 解决方法两个: 1.增加系统的递归调用的次数: import sys sys.setrecursionlimit(n) n为你想要的递归上限 2.优化代码,减少递归的次数. 原文地址:https://www.cnblogs.com/everfight/p/maximum_recursion.html

Python的最大递归深度错误 “maximum recursion depth exceeded while calling a Python object”

今天在写爬虫的时候,发现了一个诡异的事情,使用str方法强制转换一个BeautifulSoup对象成字符串的时候报错了,提示是"maximum recursion depth exceeded while calling a Python object",意思大致是"当调用该对象超过最大递归深度" 报错如下:   Traceback (most recent call last):   File "<stdin>", line 1, 

函数递归时,递归次数到900多时,就是抛出异常exception RuntimeError(&#39;maximum recursion depth exceeded&#39;,)

import subprocess import multiprocessing import urllib import sys import os import pymongo import signal import time client=pymongo.MongoClient("192.168.139.143",27017) db=client.domaindb collection=db.domain def getdomain(i): print("proces

Odoo8查询产品时提示&quot;maximum recursion depth exceeded while calling a Python object&quot;

今天在生产系统中查询产品时,莫名提示错误:maximum recursion depth exceeded while calling a Python object,根据错误日志提示,发现在查询产品时,系统会构造一个domain,查询所有库位的库存量.当仓库较多的时候,构造的这个domain比较长,然后解析这个domain的方法distribute_negate是递归调用,因为递归次数太多,所以就提示错误. 根据源码查看了生成domain的条件,这个部分不太好调整,所以后来直接找了个方法来增加

python --RecursionError: maximum recursion depth exceeded in comparison

在学习汉娜塔的时候,遇到一个error RecursionError: maximum recursion depth exceeded in comparison 经过百度,百度的方法: 加上: import sys sys.setrecursionlimit(100000) 可是我加上之后结果如下,并没有解决问题,python还提示意外退出: 1.再此经过思考(也不是思考,再从头看了学习视频,添加了两个return None,问题解决??????) python 函数要么返回预期的值,要么返

pyinstaller打包报错: RecursionError: maximum recursion depth exceeded,UnicodeDecodeError 解决办法

出现原因:     这个错误意思是超过最大递归深度,python默认的递归深度默认是1000),因此当递归深度超过就会引发这样的异常. 解决方法: 1.执行pyinstaller -F XXX.py 它会在你的目录文件生成XXX.spec文件,然后报错,出现该类异常. 2.打开XXX.spec文件,在开头添加上面两行代码. import sys sys.setrecursionlimit(1000000) 3.继续执行打包,但是还文件名:pyinstaller -F XXX.spec ,执行该文

python RecursionError: maximum recursion depth exceeded in comparison错误

处理快速排序,递归深度可能非常大,而系统默认的深度可能没有这么大 需要设置最大递归深度 1 import sys 2 sys.setrecursionlimit(100000) # 这个值的大小取决你自己,最好适中即可,执行完递归再降低,毕竟递归深度太大,如果是其他未知的操作引起,可能会造成内存溢出