Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.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_Python 3.x_Database - Fatal编程技术网

Python守护进程模式不返回信息

Python守护进程模式不返回信息,python,python-3.x,database,Python,Python 3.x,Database,我在我的代码中使用了dameon模式,但我一点儿也不了解如何使用python守护进程 def get_data(): database = DB.connect("mydb.db") cur = database.cursor() sql_select_query = "SELECT * FROM data;" cursor.execute(sql_select_query, ) data = cursor.fetchall() cursor.cl

我在我的代码中使用了dameon模式,但我一点儿也不了解如何使用python守护进程

def get_data():
    database = DB.connect("mydb.db")
    cur = database.cursor()
    sql_select_query = "SELECT * FROM data;"
    cursor.execute(sql_select_query, )
    data = cursor.fetchall()
    cursor.close()
    database.close()

    return data


def run():
    with daemon.DaemonContext():
        print(get_data())

if __name__ == '__main__':
    run()
当我运行我的文件时,它工作,但不返回任何东西,没有守护进程,它返回db table。请告诉我daemon的功能是什么?为什么我的代码不返回任何内容

提前谢谢你