diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py --- a/hgext/convert/monotone.py +++ b/hgext/convert/monotone.py @@ -27,7 +27,9 @@ class monotone_source(converter_source, if not os.path.exists(os.path.join(path, '_MTN')): # Could be a monotone repository (SQLite db file) try: - header = file(path, 'rb').read(16) + f = file(path, 'rb') + header = f.read(16) + f.close() except: header = '' if header != 'SQLite format 3\x00': diff --git a/hgext/inotify/linuxserver.py b/hgext/inotify/linuxserver.py --- a/hgext/inotify/linuxserver.py +++ b/hgext/inotify/linuxserver.py @@ -44,7 +44,7 @@ def walkrepodirs(dirstate, absroot): def _explain_watch_limit(ui, dirstate, rootabs): path = '/proc/sys/fs/inotify/max_user_watches' try: - limit = int(file(path).read()) + limit = int(util.readfile(path)) except IOError, err: if err.errno != errno.ENOENT: raise