Skip to content

Commit

Permalink
Python 3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Forkest committed Nov 11, 2015
1 parent d260eae commit 7587d08
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions examples/dirwatch.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python

from __future__ import print_function

import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from fsmonitor import FSMonitor

if len(sys.argv) < 2:
print "usage: dirwatch.py [DIRS...]"
print("usage: dirwatch.py [DIRS...]")
sys.exit(1)

m = FSMonitor()
Expand All @@ -14,4 +16,4 @@

while True:
for evt in m.read_events():
print "%s %s %s" % (evt.action_name, evt.watch.path, evt.name)
print("%s %s %s" % (evt.action_name, evt.watch.path, evt.name))
6 changes: 4 additions & 2 deletions examples/filewatch.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python

from __future__ import print_function

import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from fsmonitor import FSMonitor

if len(sys.argv) < 2:
print "usage: filewatch.py [FILES...]"
print("usage: filewatch.py [FILES...]")
sys.exit(1)

m = FSMonitor()
Expand All @@ -14,4 +16,4 @@

while True:
for evt in m.read_events():
print "%s %s %s" % (evt.action_name, evt.watch.path, evt.name)
print("%s %s %s" % (evt.action_name, evt.watch.path, evt.name))
4 changes: 3 additions & 1 deletion fsmonitor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# The file is part of FSMonitor, a file-system monitoring library.
# https://github.com/shaurz/fsmonitor

from __future__ import print_function

import sys
import threading
import traceback
Expand Down Expand Up @@ -64,7 +66,7 @@ def run(self):
with self._events_lock:
self._events.extend(events)
except Exception:
print "Exception in FSMonitorThread:\n" + traceback.format_exc()
print("Exception in FSMonitorThread:\n" + traceback.format_exc())

def stop(self):
if self.monitor.watches:
Expand Down

0 comments on commit 7587d08

Please sign in to comment.