JanKanis avatar JanKanis committed 1d6a9fe

use modern 'except ... as ...' syntax in __init__.py and watcher.py

Comments (0)

Files changed (2)

inotify/__init__.py

     def read_value():
         try:
             return int(open(procfs_path + '/' + name).read())
-        except OSError, err:
+        except OSError as err:
             return None
 
     read_value.__doc__ = '''Return the value of the %s setting from /proc.

inotify/watcher.py

 
         try:
             yield self.add(path, mask)
-        except OSError, err:
+        except OSError as err:
             if onerror and err.errno not in self.ignored_errors:
                 onerror(err)
         for root, dirs, names in os.walk(path, topdown=False, onerror=onerror):
             for d in dirs:
                 try:
                     yield self.add(root + '/' + d, submask)
-                except OSError, err:
+                except OSError as err:
                     if onerror and err.errno not in self.ignored_errors:
                         onerror(err)
 
                     mask = parentmask | inotify.IN_ONLYDIR
                     try:
                         self.add_all(evt.fullpath, mask)
-                    except OSError, err:
+                    except OSError as err:
                         if err.errno not in self.ignored_errors:
                             raise
         return events
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.