Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.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 Twisted:目录中新文件的事件_Python_Windows_Python 2.7_Twisted_Event Driven - Fatal编程技术网

Python Twisted:目录中新文件的事件

Python Twisted:目录中新文件的事件,python,windows,python-2.7,twisted,event-driven,Python,Windows,Python 2.7,Twisted,Event Driven,我有一个应用程序,它在新文件出现在特定目录时运行。 为此,我使用nncron(cronforwindows)作为示例 #( 500 VALUE MonitorDirTimeout WatchDir: "c:\directory" WatchSubtree WATCH-CHANGE-LAST-WRITE Action: StartIn: "c:\directory" SWHide NormalPriority START-APP: c:\app.

我有一个应用程序,它在新文件出现在特定目录时运行。 为此,我使用nncron(cronforwindows)作为示例

#(
500 VALUE MonitorDirTimeout
WatchDir: "c:\directory" WatchSubtree
WATCH-CHANGE-LAST-WRITE
Action:
        StartIn: "c:\directory"
        SWHide   NormalPriority
        START-APP: c:\app.py
)#
我希望使用事件驱动编程和Twisted,并希望在目录中出现新文件时执行回调。
当然,我可以使用监视目录,但它不是事件驱动的。

我没有足够的windows来提供直接的解决方案,但您可以通过在组成给定reactor/eventloop的系统调用中搜索所需的事件来找到方法。 (即搜索操作系统级API文档,不要将搜索限制为python或twisted)

我看到WFMO和IOCP是Windows中使用的系统框架。如果您可以找到解释如何在目录更新时触发其中一个事件系统的windows文档,那么应该有一种直接的方法在twisted中触发(而不必轮询),尽管如果您是此空间中的第一个,您可能需要编写一些接口代码

顺便说一句,这里有一系列(非扭曲的)想法,其中最直接相关的是: