今天使用了openduckbill
由于openduckbill最近没有更新,而pyinotify更新了,所以导致openduckbill出现异常
AttributeError: type object 'EventsCodes' has no attribute 'IN_CLOSE_WRITE'
解决办法,打入以下patch
diff -ruN openduckbill-1.0.0/src/daemon.py pdir/src/daemon.py
--- openduckbill-1.0.0/src/daemon.py 2008-02-20 19:41:41.000000000 +0800
+++ pdir/src/daemon.py 2010-10-12 11:49:07.863957042 +0800
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.4
+#!/usr/bin/python
# Copyright 2008 Google Inc.
# Author : Anoop Chandran
@@ -334,10 +334,10 @@
avail_events = pyinotify.EventsCodes
# Events to be monitored.
- eventsmonitored = (avail_events.IN_CLOSE_WRITE | avail_events.IN_CREATE
- avail_events.IN_DELETE | avail_events.IN_MODIFY
- avail_events.IN_MOVED_FROM | avail_events.IN_MOVED_TO
- avail_events.IN_ATTRIB | avail_events.IN_MOVE_SELF)
+ eventsmonitored = (avail_events.OP_FLAGS['IN_CLOSE_WRITE'] | avail_events.OP_FLAGS['IN_CREATE']
+ avail_events.OP_FLAGS['IN_DELETE'] | avail_events.OP_FLAGS['IN_MODIFY']
+ avail_events.OP_FLAGS['IN_MOVED_FROM'] | avail_events.OP_FLAGS['IN_MOVED_TO']
+ avail_events.OP_FLAGS['IN_ATTRIB'] | avail_events.OP_FLAGS['IN_MOVE_SELF'])
# Start a event watcher
event_watcher = pyinotify.WatchManager()
# Create a event processor
diff -ruN openduckbill-1.0.0/src/openduckbilld.py pdir/src/openduckbilld.py
--- openduckbill-1.0.0/src/openduckbilld.py 2008-02-20 19:41:41.000000000 +0800
+++ pdir/src/openduckbilld.py 2010-10-12 11:49:41.927943049 +0800
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.4
+#!/usr/bin/python
# Copyright 2008 Google Inc.
# Author : Anoop Chandran