捕获递归深度后在python中获取错误的文件描述符错误
我试图学习更多关于python中的数据挖掘过程的知识。我运行了下面的代码,得到了两个错误捕获递归深度后在python中获取错误的文件描述符错误,python,operating-system,daemon,Python,Operating System,Daemon,我试图学习更多关于python中的数据挖掘过程的知识。我运行了下面的代码,得到了两个错误 [2020-03-19 08:43:06079 40116 MainProcess test.py文件_read 35:错误]cmp中超出了最大递归深度 [2020-03-19 08:43:08766 40116 MainProcess test.py文件_read 35:ERROR][Errno 9]文件描述符错误[试图关闭foo时] 虽然1有意义,但2没有意义。有人能帮我吗 def file_read(
def file_read(filename):
file_content = None
with open(filename, "r") as file:
try:
logging.finfo('loading file %s' % filename)
file_content = read_meta_file(file)
except (FileNotFoundError, ApacheConfigError) as err:
logging.exception(err)
with daemon.DaemonContext():
pass
try:
file_read(filename)
except Exception as err:
logging.ferror(err)
raise
return file_content
file_read('foo.txt')
如果您使用的是递归,即函数本身调用,则必须有一个中断条件,该条件最终将结束递归。在您的代码中,没有任何中断条件