Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
捕获递归深度后在python中获取错误的文件描述符错误_Python_Operating System_Daemon - Fatal编程技术网

捕获递归深度后在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(

我试图学习更多关于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(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')
    

    如果您使用的是递归,即函数本身调用,则必须有一个中断条件,该条件最终将结束递归。在您的代码中,没有任何中断条件