summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorstepshal <nessento@openmailbox.org>2016-06-22 00:01:38 +0700
committerstepshal <nessento@openmailbox.org>2016-06-22 00:01:38 +0700
commitbedfed3db77ecaafdb86e9e4847c7bb6ddc2563d (patch)
tree274a6e10436c085ac8421b53d7930761b6a08f60
parent5348e120aa6d39604b2426577f84669b9ce0aa24 (diff)
downloadranger-bedfed3db77ecaafdb86e9e4847c7bb6ddc2563d.tar.gz
Use 'except Exception:' instead of 'except:'
-rwxr-xr-xdoc/tools/print_colors.py4
-rw-r--r--ranger/api/commands.py6
-rwxr-xr-xranger/config/commands.py10
-rw-r--r--ranger/container/bookmarks.py4
-rw-r--r--ranger/container/directory.py12
-rw-r--r--ranger/container/file.py4
-rw-r--r--ranger/container/fsobject.py12
-rw-r--r--ranger/container/history.py4
-rw-r--r--ranger/container/settings.py4
-rw-r--r--ranger/core/actions.py26
-rw-r--r--ranger/core/fm.py6
-rw-r--r--ranger/core/loader.py10
-rw-r--r--ranger/core/main.py10
-rw-r--r--ranger/core/runner.py6
-rw-r--r--ranger/core/tab.py2
-rw-r--r--ranger/ext/cached_function.py2
-rw-r--r--ranger/ext/direction.py10
-rw-r--r--ranger/ext/get_executables.py4
-rw-r--r--ranger/ext/img_display.py4
-rw-r--r--ranger/ext/keybinding_parser.py8
-rwxr-xr-xranger/ext/rifle.py2
-rw-r--r--ranger/ext/shutil_generatorized.py6
-rw-r--r--ranger/ext/signals.py6
-rw-r--r--ranger/ext/widestring.py2
-rw-r--r--ranger/gui/ansi.py2
-rw-r--r--ranger/gui/color.py4
-rw-r--r--ranger/gui/colorscheme.py2
-rw-r--r--ranger/gui/curses_shortcuts.py10
-rw-r--r--ranger/gui/displayable.py6
-rw-r--r--ranger/gui/mouse_event.py2
-rw-r--r--ranger/gui/ui.py8
-rw-r--r--ranger/gui/widgets/browsercolumn.py4
-rw-r--r--ranger/gui/widgets/console.py14
-rw-r--r--ranger/gui/widgets/pager.py2
-rw-r--r--ranger/gui/widgets/statusbar.py8
-rw-r--r--ranger/gui/widgets/titlebar.py2
-rw-r--r--ranger/gui/widgets/view_base.py8
-rw-r--r--ranger/gui/widgets/view_miller.py4
38 files changed, 120 insertions, 120 deletions
diff --git a/doc/tools/print_colors.py b/doc/tools/print_colors.py
index feae8e35..8cc944ed 100755
--- a/doc/tools/print_colors.py
+++ b/doc/tools/print_colors.py
@@ -14,14 +14,14 @@ def main(win):
         for c in range(-1, curses.COLORS):
             try:
                 init_pair(c, c, 0)
-            except:
+            except Exception:
                 pass
             else:
                 win.addstr(str(c) + ' ', color_pair(c) | attr)
     start_color()
     try:
         use_default_colors()
-    except:
+    except Exception:
         pass
     win.addstr("available colors: %d\n\n" % curses.COLORS)
     print_all_colors(0)
diff --git a/ranger/api/commands.py b/ranger/api/commands.py
index 6a9abe65..9b8ec7d5 100644
--- a/ranger/api/commands.py
+++ b/ranger/api/commands.py
@@ -31,7 +31,7 @@ class CommandContainer(object):
             cmd._line = full_command
             self.commands[name] = cmd
 
-        except:
+        except Exception:
             pass
 
     def load_commands_from_module(self, module):
@@ -394,13 +394,13 @@ class FunctionCommand(Command):
             value = arg if (equal_sign is -1) else arg[equal_sign + 1:]
             try:
                 value = int(value)
-            except:
+            except Exception:
                 if value in ('True', 'False'):
                     value = (value == 'True')
                 else:
                     try:
                         value = float(value)
-                    except:
+                    except Exception:
                         pass
 
             if equal_sign == -1:
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 1bb688cb..73272eb0 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -598,7 +598,7 @@ class console(Command):
             try:
                 position = int(self.arg(1)[2:])
                 self.shift()
-            except:
+            except Exception:
                 pass
         self.fm.open_console(self.rest(1), position=position)
 
@@ -616,7 +616,7 @@ class load_copy_buffer(Command):
         try:
             fname = self.fm.confpath(self.copy_buffer_filename)
             f = open(fname, 'r')
-        except:
+        except Exception:
             return self.fm.notify("Cannot open %s" %
                     (fname or self.copy_buffer_filename), bad=True)
         self.fm.copy_buffer = set(File(g)
@@ -637,7 +637,7 @@ class save_copy_buffer(Command):
         try:
             fname = self.fm.confpath(self.copy_buffer_filename)
             f = open(fname, 'w')
-        except:
+        except Exception:
             return self.fm.notify("Cannot open %s" %
                     (fname or self.copy_buffer_filename), bad=True)
         f.write("\n".join(f.path for f in self.fm.copy_buffer))
@@ -846,7 +846,7 @@ class chmod(Command):
             # reloading directory.  maybe its better to reload the selected
             # files only.
             self.fm.thisdir.load_content()
-        except:
+        except Exception:
             pass
 
 
@@ -1262,7 +1262,7 @@ class scout(Command):
             options |= re.IGNORECASE
         try:
             self._regex = re.compile(regex, options)
-        except:
+        except Exception:
             self._regex = re.compile("")
         return self._regex
 
diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py
index 1a42fb13..8504bef9 100644
--- a/ranger/container/bookmarks.py
+++ b/ranger/container/bookmarks.py
@@ -157,7 +157,7 @@ class Bookmarks(object):
                         and key in ALLOWED_KEYS:
                     try:
                         f.write("{0}:{1}\n".format(str(key), str(value)))
-                    except:
+                    except Exception:
                         pass
 
             f.close()
@@ -179,7 +179,7 @@ class Bookmarks(object):
         if not os.path.exists(self.path):
             try:
                 f = open(self.path, 'w')
-            except:
+            except Exception:
                 raise OSError('Cannot read the given path')
             f.close()
 
diff --git a/ranger/container/directory.py b/ranger/container/directory.py
index 923821a0..f46f9d55 100644
--- a/ranger/container/directory.py
+++ b/ranger/container/directory.py
@@ -326,14 +326,14 @@ class Directory(FileSystemObject, Accumulator, Loadable):
                             file_stat = file_lstat
                         stats = (file_stat, file_lstat)
                         is_a_dir = file_stat.st_mode & 0o170000 == 0o040000
-                    except:
+                    except Exception:
                         stats = None
                         is_a_dir = False
                     if is_a_dir:
                         try:
                             item = self.fm.get_directory(name)
                             item.load_if_outdated()
-                        except:
+                        except Exception:
                             item = Directory(name, preload=stats, path_is_abs=True,
                                              basename_is_rel_to=basename_is_rel_to)
                             item.load()
@@ -442,7 +442,7 @@ class Directory(FileSystemObject, Accumulator, Loadable):
 
         try:
             sort_func = self.sort_dict[self.settings.sort]
-        except:
+        except Exception:
             sort_func = sort_by_basename
 
         if self.settings.sort_case_insensitive and \
@@ -484,7 +484,7 @@ class Directory(FileSystemObject, Accumulator, Loadable):
                     else:
                         stat = os_stat(dirpath + "/" + file)
                     cum += stat.st_size
-                except:
+                except Exception:
                     pass
         return cum
 
@@ -538,7 +538,7 @@ class Directory(FileSystemObject, Accumulator, Loadable):
     def move_to_obj(self, arg):
         try:
             arg = arg.path
-        except:
+        except Exception:
             pass
         self.load_content_once(schedule=False)
         if self.empty():
@@ -587,7 +587,7 @@ class Directory(FileSystemObject, Accumulator, Loadable):
         try:
             if self == self.fm.thisdir:
                 self.fm.thisfile = self.pointed_obj
-        except:
+        except Exception:
             pass
 
     def load_content_once(self, *a, **k):
diff --git a/ranger/container/file.py b/ranger/container/file.py
index 40a4f73d..3058b9db 100644
--- a/ranger/container/file.py
+++ b/ranger/container/file.py
@@ -50,13 +50,13 @@ class File(FileSystemObject):
     def firstbytes(self):
         try:
             return self._firstbytes
-        except:
+        except Exception:
             try:
                 f = open(self.path, 'r')
                 self._firstbytes = f.read(N_FIRST_BYTES)
                 f.close()
                 return self._firstbytes
-            except:
+            except Exception:
                 pass
 
     def is_binary(self):
diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py
index b6c0c9ec..d73fa76c 100644
--- a/ranger/container/fsobject.py
+++ b/ranger/container/fsobject.py
@@ -153,14 +153,14 @@ class FileSystemObject(FileManagerAware, SettingsAware):
     def user(self):
         try:
             return getpwuid(self.stat.st_uid)[0]
-        except:
+        except Exception:
             return str(self.stat.st_uid)
 
     @lazy_property
     def group(self):
         try:
             return getgrgid(self.stat.st_gid)[0]
-        except:
+        except Exception:
             return str(self.stat.st_gid)
 
     for attr in ('video', 'audio', 'image', 'media', 'document', 'container'):
@@ -205,7 +205,7 @@ class FileSystemObject(FileManagerAware, SettingsAware):
     def mimetype(self):
         try:
             return self._mimetype
-        except:
+        except Exception:
             self.set_mimetype()
             return self._mimetype
 
@@ -213,7 +213,7 @@ class FileSystemObject(FileManagerAware, SettingsAware):
     def mimetype_tuple(self):
         try:
             return self._mimetype_tuple
-        except:
+        except Exception:
             self.set_mimetype()
             return self._mimetype_tuple
 
@@ -230,7 +230,7 @@ class FileSystemObject(FileManagerAware, SettingsAware):
         if self.is_link:
             try:
                 return realpath(self.path)
-            except:
+            except Exception:
                 return None  # it is impossible to get the link destination
         return self.path
 
@@ -264,7 +264,7 @@ class FileSystemObject(FileManagerAware, SettingsAware):
                 if self.is_link:
                     new_stat = stat(path)
                 self.exists = True
-            except:
+            except Exception:
                 self.exists = False
 
         # Set some attributes
diff --git a/ranger/container/history.py b/ranger/container/history.py
index d92f2910..73e5fe7f 100644
--- a/ranger/container/history.py
+++ b/ranger/container/history.py
@@ -30,7 +30,7 @@ class History(object):
         if self.unique:
             try:
                 self._history.remove(item)
-            except:
+            except Exception:
                 pass
         else:
             if self._history and self._history[-1] == item:
@@ -47,7 +47,7 @@ class History(object):
             try:
                 self._history.remove(item)
                 self._index -= 1
-            except:
+            except Exception:
                 pass
         try:
             self._history[self._index] = item
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 18a16b98..704540b2 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -151,7 +151,7 @@ class Settings(SignalDispatcher, FileManagerAware):
         else:
             try:
                 localpath = self.fm.thisdir.path
-            except:
+            except Exception:
                 localpath = path
 
         if localpath:
@@ -222,7 +222,7 @@ class Settings(SignalDispatcher, FileManagerAware):
             if path not in self._localsettings:
                 try:
                     regex = re.compile(path)
-                except:
+                except Exception:
                     # Bad regular expression
                     return
                 self._localregexes[path] = regex
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index d7385355..9b806d56 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -134,7 +134,7 @@ class Actions(FileManagerAware, SettingsAware):
         """
         try:
             cwd = self.thisdir
-        except:
+        except Exception:
             pass
         else:
             cwd.unload()
@@ -166,7 +166,7 @@ class Actions(FileManagerAware, SettingsAware):
         """
         try:
             item = self.loader.queue[0]
-        except:
+        except Exception:
             self.notify("Type Q or :quit<Enter> to exit ranger")
         else:
             self.notify("Aborting: " + item.get_description())
@@ -283,7 +283,7 @@ class Actions(FileManagerAware, SettingsAware):
         for i in range(1, 10):
             try:
                 tab = self.fm.tabs[i]
-            except:
+            except Exception:
                 continue
             tabdir = tab.thisdir
             if not tabdir:
@@ -429,7 +429,7 @@ class Actions(FileManagerAware, SettingsAware):
                 steps *= narg
             try:
                 directory = os.path.join(*(['..'] * steps))
-            except:
+            except Exception:
                 return
             self.thistab.enter_dir(directory)
             self.change_mode('normal')
@@ -455,7 +455,7 @@ class Actions(FileManagerAware, SettingsAware):
                 if self.mode == 'visual':
                     try:
                         startpos = cwd.index(self._visual_start)
-                    except:
+                    except Exception:
                         self._visual_start = None
                         startpos = min(self._visual_start_pos, len(cwd))
                     # The files between here and _visual_start_pos
@@ -690,7 +690,7 @@ class Actions(FileManagerAware, SettingsAware):
         if isinstance(text, str) and regexp:
             try:
                 text = re.compile(text, re.L | re.U | re.I)
-            except:
+            except Exception:
                 return False
         self.thistab.last_search = text
         self.search_next(order='search', offset=offset)
@@ -819,7 +819,7 @@ class Actions(FileManagerAware, SettingsAware):
     def draw_possible_programs(self):
         try:
             target = self.thistab.get_selection()[0]
-        except:
+        except Exception:
             self.ui.browser.draw_info = []
             return
         programs = [program for program in self.rifle.list_commands([target.path],
@@ -841,7 +841,7 @@ class Actions(FileManagerAware, SettingsAware):
     def display_command_help(self, console_widget):
         try:
             command = console_widget._get_cmd_class()
-        except:
+        except Exception:
             self.notify("Feature not available!", bad=True)
             return
 
@@ -893,7 +893,7 @@ class Actions(FileManagerAware, SettingsAware):
         try:
             del self.previews[path]
             self.ui.need_redraw = True
-        except:
+        except Exception:
             return False
 
     if version_info[0] == 3:
@@ -924,7 +924,7 @@ class Actions(FileManagerAware, SettingsAware):
             # PDF file.
             try:
                 data = self.previews[path]
-            except:
+            except Exception:
                 data = self.previews[path] = {'loading': False}
             else:
                 if data['loading']:
@@ -935,7 +935,7 @@ class Actions(FileManagerAware, SettingsAware):
             if found is False:
                 try:
                     stat_ = os.stat(self.settings.preview_script)
-                except:
+                except Exception:
                     self.fm.notify("Preview Script `%s' doesn't exist!" %
                             self.settings.preview_script, bad=True)
                     return None
@@ -1016,7 +1016,7 @@ class Actions(FileManagerAware, SettingsAware):
                 def on_destroy(signal):
                     try:
                         del self.previews[path]
-                    except:
+                    except Exception:
                         pass
                 loadable.signal_bind('after', on_after)
                 loadable.signal_bind('destroy', on_destroy)
@@ -1027,7 +1027,7 @@ class Actions(FileManagerAware, SettingsAware):
         else:
             try:
                 return codecs.open(path, 'r', errors='ignore')
-            except:
+            except Exception:
                 return None
 
     # --------------------------
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index a827bb6c..cabb6c2b 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -65,7 +65,7 @@ class FM(Actions, SignalDispatcher):
 
         try:
             self.username = pwd.getpwuid(os.geteuid()).pw_name
-        except:
+        except Exception:
             self.username = 'uid:' + str(os.geteuid())
         self.hostname = socket.gethostname()
         self.home_path = os.path.expanduser('~')
@@ -188,13 +188,13 @@ class FM(Actions, SignalDispatcher):
         if self.ui:
             try:
                 self.ui.destroy()
-            except:
+            except Exception:
                 if debug:
                     raise
         if self.loader:
             try:
                 self.loader.destroy()
-            except:
+            except Exception:
                 if debug:
                     raise
 
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index bae0e54d..0cdc5368 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -14,7 +14,7 @@ import select
 try:
     import chardet
     HAVE_CHARDET = True
-except:
+except Exception:
     HAVE_CHARDET = False
 
 
@@ -36,7 +36,7 @@ class Loadable(object):
     def unpause(self):
         try:
             del self.paused
-        except:
+        except Exception:
             pass
 
     def destroy(self):
@@ -70,7 +70,7 @@ class CopyLoader(Loadable, FileManagerAware):
             else:
                 try:
                     fstat = os.stat(fname)
-                except:
+                except Exception:
                     continue
                 size += max(step, math.ceil(fstat.st_size / step) * step)
         return size
@@ -236,7 +236,7 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
                 return
             try:
                 self.process.send_signal(20)
-            except:
+            except Exception:
                 pass
             Loadable.pause(self)
             self.signal_emit('pause', process=self.process, loader=self)
@@ -245,7 +245,7 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
         if not self.finished and self.paused:
             try:
                 self.process.send_signal(18)
-            except:
+            except Exception:
                 pass
             Loadable.unpause(self)
             self.signal_emit('unpause', process=self.process, loader=self)
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 77e06861..fefffad5 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -19,7 +19,7 @@ def main():
 
     try:
         locale.setlocale(locale.LC_ALL, '')
-    except:
+    except Exception:
         print("Warning: Unable to set locale.  Expect encoding problems.")
 
     # so that programs can know that ranger spawned them:
@@ -44,7 +44,7 @@ def main():
                 f = open(fm.confpath('tagged'), 'r', errors='replace')
             else:
                 f = open(fm.confpath('tagged'), 'r')
-        except:
+        except Exception:
             pass
         else:
             for line in f.readlines():
@@ -153,7 +153,7 @@ def main():
         if crash_traceback:
             try:
                 filepath = fm.thisfile.path if fm.thisfile else "None"
-            except:
+            except Exception:
                 filepath = "None"
         try:
             fm.ui.destroy()
@@ -167,7 +167,7 @@ def main():
             print("Locale: %s" % '.'.join(str(s) for s in locale.getlocale()))
             try:
                 print("Current file: %s" % filepath)
-            except:
+            except Exception:
                 pass
             print(crash_traceback)
             print("ranger crashed.  "
@@ -294,7 +294,7 @@ def load_settings(fm, clean):
             plugindir = fm.confpath('plugins')
             plugins = [p[:-3] for p in os.listdir(plugindir)
                     if p.endswith('.py') and not p.startswith('_')]
-        except:
+        except Exception:
             pass
         else:
             if not os.path.exists(fm.confpath('plugins', '__init__.py')):
diff --git a/ranger/core/runner.py b/ranger/core/runner.py
index 60e14202..6d03f8fb 100644
--- a/ranger/core/runner.py
+++ b/ranger/core/runner.py
@@ -69,7 +69,7 @@ class Context(object):
     def filepaths(self):
         try:
             return [f.path for f in self.files]
-        except:
+        except Exception:
             return []
 
     def __iter__(self):
@@ -104,12 +104,12 @@ class Runner(object):
             if boolean:
                 try:
                     self.ui.initialize()
-                except:
+                except Exception:
                     self._log("Failed to initialize UI")
             else:
                 try:
                     self.ui.suspend()
-                except:
+                except Exception:
                     self._log("Failed to suspend UI")
 
     def __call__(self, action=None, try_app_first=False,
diff --git a/ranger/core/tab.py b/ranger/core/tab.py
index faaaddfd..7b60a5b1 100644
--- a/ranger/core/tab.py
+++ b/ranger/core/tab.py
@@ -126,7 +126,7 @@ class Tab(FileManagerAware, SettingsAware):
 
         try:
             os.chdir(path)
-        except:
+        except Exception:
             return True
         self.path = path
         self.thisdir = new_thisdir
diff --git a/ranger/ext/cached_function.py b/ranger/ext/cached_function.py
index 48461a8d..6c1c7769 100644
--- a/ranger/ext/cached_function.py
+++ b/ranger/ext/cached_function.py
@@ -8,7 +8,7 @@ def cached_function(fnc):
     def inner_cached_function(*args):
         try:
             return cache[args]
-        except:
+        except Exception:
             value = fnc(*args)
             cache[args] = value
             return value
diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py
index 7dc74a18..8d3e7e7a 100644
--- a/ranger/ext/direction.py
+++ b/ranger/ext/direction.py
@@ -35,19 +35,19 @@ class Direction(dict):
     def _get_bool(self, first, second, fallback=None):
         try:
             return self[first]
-        except:
+        except Exception:
             try:
                 return not self[second]
-            except:
+            except Exception:
                 return fallback
 
     def _get_direction(self, first, second, fallback=0):
         try:
             return self[first]
-        except:
+        except Exception:
             try:
                 return -self[second]
-            except:
+            except Exception:
                 return fallback
 
     def up(self):
@@ -95,7 +95,7 @@ class Direction(dict):
         for key in ('up', 'right', 'down', 'left'):
             try:
                 self[key] *= n
-            except:
+            except Exception:
                 pass
 
     def set(self, n):
diff --git a/ranger/ext/get_executables.py b/ranger/ext/get_executables.py
index b3ffcd33..ee988e49 100644
--- a/ranger/ext/get_executables.py
+++ b/ranger/ext/get_executables.py
@@ -33,13 +33,13 @@ def get_executables_uncached(*paths):
     for path in paths:
         try:
             content = listdir(path)
-        except:
+        except Exception:
             continue
         for item in content:
             abspath = path + '/' + item
             try:
                 filestat = stat(abspath)
-            except:
+            except Exception:
                 continue
             if filestat.st_mode & (S_IXOTH | S_IFREG):
                 executables.add(item)
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 1ee421d7..521a2dad 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -252,7 +252,7 @@ class ITerm2ImageDisplayer(ImageDisplayer, FileManagerAware):
         file = open(path, 'rb')
         try:
             return base64.b64encode(file.read())
-        except:
+        except Exception:
             return ""
         finally:
             file.close()
@@ -287,7 +287,7 @@ class ITerm2ImageDisplayer(ImageDisplayer, FileManagerAware):
                     size = struct.unpack('>H', file_handle.read(2))[0] - 2
                 file_handle.seek(1, 1)
                 height, width = struct.unpack('>HH', file_handle.read(4))
-            except:
+            except Exception:
                 file_handle.close()
                 return 0, 0
         else:
diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py
index 84a4a068..68c44fa3 100644
--- a/ranger/ext/keybinding_parser.py
+++ b/ranger/ext/keybinding_parser.py
@@ -146,7 +146,7 @@ def _unbind_traverse(pointer, keys, pos=0):
         try:
             del pointer[keys[pos]]
             keys.pop()
-        except:
+        except Exception:
             pass
 
 
@@ -165,7 +165,7 @@ class KeyMaps(dict):
     def _clean_input(self, context, keys):
         try:
             pointer = self[context]
-        except:
+        except Exception:
             self[context] = pointer = dict()
         if PY3:
             keys = keys.encode('utf-8').decode('latin-1')
@@ -182,7 +182,7 @@ class KeyMaps(dict):
                     pointer = pointer[key]
                 else:
                     pointer[key] = pointer = dict()
-            except:
+            except Exception:
                 pointer[key] = pointer = dict()
         pointer[last_key] = leaf
 
@@ -193,7 +193,7 @@ class KeyMaps(dict):
         for key in clean_source:
             try:
                 pointer = pointer[key]
-            except:
+            except Exception:
                 raise KeyError("Tried to copy the keybinding `%s',"
                         " but it was not found." % source)
         self.bind(context, target, copy.deepcopy(pointer))
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index 08515cb0..f5a492b6 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -92,7 +92,7 @@ def _is_terminal():
         os.ttyname(0)
         os.ttyname(1)
         os.ttyname(2)
-    except:
+    except Exception:
         return False
     return True
 
diff --git a/ranger/ext/shutil_generatorized.py b/ranger/ext/shutil_generatorized.py
index 470aff7e..b990aded 100644
--- a/ranger/ext/shutil_generatorized.py
+++ b/ranger/ext/shutil_generatorized.py
@@ -92,17 +92,17 @@ def copystat(src, dst):
     if hasattr(os, 'utime'):
         try:
             os.utime(dst, (st.st_atime, st.st_mtime))
-        except:
+        except Exception:
             pass
     if hasattr(os, 'chmod'):
         try:
             os.chmod(dst, mode)
-        except:
+        except Exception:
             pass
     if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):
         try:
             os.chflags(dst, st.st_flags)
-        except:
+        except Exception:
             pass
 
 
diff --git a/ranger/ext/signals.py b/ranger/ext/signals.py
index 1e907b70..4167277f 100644
--- a/ranger/ext/signals.py
+++ b/ranger/ext/signals.py
@@ -134,7 +134,7 @@ class SignalDispatcher(object):
         assert isinstance(weak, bool)
         try:
             handlers = self._signals[signal_name]
-        except:
+        except Exception:
             handlers = self._signals[signal_name] = []
         nargs = function.__code__.co_argcount
 
@@ -173,13 +173,13 @@ class SignalDispatcher(object):
         """
         try:
             handlers = self._signals[signal_handler._signal_name]
-        except:
+        except Exception:
             pass
         else:
             try:
                 signal_handler._function = None
                 handlers.remove(signal_handler)
-            except:
+            except Exception:
                 pass
 
     def signal_garbage_collect(self):
diff --git a/ranger/ext/widestring.py b/ranger/ext/widestring.py
index b042c45b..39333e7f 100644
--- a/ranger/ext/widestring.py
+++ b/ranger/ext/widestring.py
@@ -61,7 +61,7 @@ class WideString(object):
             # would str(string) raise a UnicodeEncodeError?
             try:
                 self.string = string.encode('latin-1', 'ignore')
-            except:
+            except Exception:
                 self.string = ""
         if chars is None:
             self.chars = string_to_charlist(string)
diff --git a/ranger/gui/ansi.py b/ranger/gui/ansi.py
index ffa9425c..4a9fb248 100644
--- a/ranger/gui/ansi.py
+++ b/ranger/gui/ansi.py
@@ -45,7 +45,7 @@ def text_with_fg_bg_attr(ansi_text):
                         n = int(arg)
                     else:                         # empty code means reset
                         n = 0
-                except:
+                except Exception:
                     continue
 
                 if n == 0:                        # reset colors and attributes
diff --git a/ranger/gui/color.py b/ranger/gui/color.py
index 78f0ccda..aa3b931c 100644
--- a/ranger/gui/color.py
+++ b/ranger/gui/color.py
@@ -28,7 +28,7 @@ def get_color(fg, bg):
         size = len(COLOR_PAIRS)
         try:
             curses.init_pair(size, fg, bg)
-        except:
+        except Exception:
             # If curses.use_default_colors() failed during the initialization
             # of curses, then using -1 as fg or bg will fail as well, which
             # we need to handle with fallback-defaults:
@@ -39,7 +39,7 @@ def get_color(fg, bg):
 
             try:
                 curses.init_pair(size, fg, bg)
-            except:
+            except Exception:
                 # If this fails too, colors are probably not supported
                 pass
         COLOR_PAIRS[key] = size
diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py
index 595f8d42..c861a8e8 100644
--- a/ranger/gui/colorscheme.py
+++ b/ranger/gui/colorscheme.py
@@ -94,7 +94,7 @@ def _colorscheme_name_to_class(signal):
     def is_scheme(x):
         try:
             return issubclass(x, ColorScheme)
-        except:
+        except Exception:
             return False
 
     # create ~/.config/ranger/colorschemes/__init__.py if it doesn't exist
diff --git a/ranger/gui/curses_shortcuts.py b/ranger/gui/curses_shortcuts.py
index 7078897a..8937fcb7 100644
--- a/ranger/gui/curses_shortcuts.py
+++ b/ranger/gui/curses_shortcuts.py
@@ -31,13 +31,13 @@ class CursesShortcuts(SettingsAware):
 
         try:
             self.win.addstr(*args)
-        except:
+        except Exception:
             if len(args) > 1:
                 self.win.move(y, x)
 
                 try:
                     self.win.addstr(*_fix_surrogates(args))
-                except:
+                except Exception:
                     pass
 
     def addnstr(self, *args):
@@ -45,13 +45,13 @@ class CursesShortcuts(SettingsAware):
 
         try:
             self.win.addnstr(*args)
-        except:
+        except Exception:
             if len(args) > 2:
                 self.win.move(y, x)
 
                 try:
                     self.win.addnstr(*_fix_surrogates(args))
-                except:
+                except Exception:
                     pass
 
     def addch(self, *args):
@@ -59,7 +59,7 @@ class CursesShortcuts(SettingsAware):
             args = [args[1], args[0]] + list(args[2:])
         try:
             self.win.addch(*args)
-        except:
+        except Exception:
             pass
 
     def color(self, *keys):
diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py
index e8b627e8..9f2dbf0d 100644
--- a/ranger/gui/displayable.py
+++ b/ranger/gui/displayable.py
@@ -169,13 +169,13 @@ class Displayable(FileManagerAware, CursesShortcuts):
             window_is_cleared = True
             try:
                 self.win.resize(hei, wid)
-            except:
+            except Exception:
                 # Not enough space for resizing...
                 try:
                     self.win.mvderwin(0, 0)
                     do_move = True
                     self.win.resize(hei, wid)
-                except:
+                except Exception:
                     pass
                     #raise ValueError("Resizing Failed!")
 
@@ -188,7 +188,7 @@ class Displayable(FileManagerAware, CursesShortcuts):
             #log("moving " + str(self))
             try:
                 self.win.mvderwin(y, x)
-            except:
+            except Exception:
                 pass
 
             self.paryx = self.win.getparyx()
diff --git a/ranger/gui/mouse_event.py b/ranger/gui/mouse_event.py
index 6931648f..1d3ec970 100644
--- a/ranger/gui/mouse_event.py
+++ b/ranger/gui/mouse_event.py
@@ -28,7 +28,7 @@ class MouseEvent(object):
         """Returns whether the mouse key n is pressed"""
         try:
             return (self.bstate & MouseEvent.PRESSED[n]) != 0
-        except:
+        except Exception:
             return False
 
     def mouse_wheel_direction(self):
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 7e873f4c..12bf3ddb 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -77,12 +77,12 @@ class UI(DisplayableContainer):
         curses.halfdelay(20)
         try:
             curses.curs_set(int(bool(self.settings.show_cursor)))
-        except:
+        except Exception:
             pass
         curses.start_color()
         try:
             curses.use_default_colors()
-        except:
+        except Exception:
             pass
 
         self.settings.signal_bind('setopt.mouse_enabled', _setup_mouse)
@@ -116,7 +116,7 @@ class UI(DisplayableContainer):
         curses.echo()
         try:
             curses.curs_set(1)
-        except:
+        except Exception:
             pass
         if self.settings.mouse_enabled:
             _setup_mouse(dict(value=False))
@@ -335,7 +335,7 @@ class UI(DisplayableContainer):
                         (curses.tigetstr('tsl').decode('latin-1'), fixed_cwd,
                          curses.tigetstr('fsl').decode('latin-1')))
                 sys.stdout.flush()
-            except:
+            except Exception:
                 pass
 
         self.win.refresh()
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index c7ef4780..829809c0 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -82,7 +82,7 @@ class BrowserColumn(Pager):
                         elif self.level == 0:
                             self.fm.thisdir.move_to_obj(clicked_file)
                             self.fm.execute_file(clicked_file)
-                    except:
+                    except Exception:
                         pass
 
         else:
@@ -103,7 +103,7 @@ class BrowserColumn(Pager):
         """
         try:
             self.win.move(line, 0)
-        except:
+        except Exception:
             return
         for entry in commands:
             text, attr = entry
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 8bb37937..78b85580 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -39,7 +39,7 @@ class Console(Widget):
             self.historypath = self.fm.confpath('history')
             try:
                 f = open(self.historypath, 'r')
-            except:
+            except Exception:
                 pass
             else:
                 for line in f:
@@ -68,7 +68,7 @@ class Console(Widget):
         if self.historypath:
             try:
                 f = open(self.historypath, 'w')
-            except:
+            except Exception:
                 pass
             else:
                 for entry in self.history_backup:
@@ -100,13 +100,13 @@ class Console(Widget):
         if self.question_queue:
             try:
                 move(self.y, len(self.question_queue[0][0]))
-            except:
+            except Exception:
                 pass
         else:
             try:
                 pos = uwid(self.line[0:self.pos]) + len(self.prompt)
                 move(self.y, self.x + min(self.wid-1, pos))
-            except:
+            except Exception:
                 pass
 
     def open(self, string='', prompt=None, position=None):
@@ -119,7 +119,7 @@ class Console(Widget):
         if self.last_cursor_mode is None:
             try:
                 self.last_cursor_mode = curses.curs_set(1)
-            except:
+            except Exception:
                 pass
         self.allow_close = False
         self.tab_deque = None
@@ -155,7 +155,7 @@ class Console(Widget):
         if self.last_cursor_mode is not None:
             try:
                 curses.curs_set(self.last_cursor_mode)
-            except:
+            except Exception:
                 pass
             self.last_cursor_mode = None
         self.fm.hide_console_info()
@@ -442,7 +442,7 @@ class Console(Widget):
             if not quiet:
                 error = "Command not found: `%s'" % self.line.split()[0]
                 self.fm.notify(error, bad=True)
-        except:
+        except Exception:
             return None
         else:
             return command_class(self.line)
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index e950ebf9..58b791cd 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -108,7 +108,7 @@ class Pager(Widget):
         elif self.markup == 'ansi':
             try:
                 self.win.move(i, 0)
-            except:
+            except Exception:
                 pass
             else:
                 for chunk in ansi.text_with_fg_bg_attr(line):
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index c0c937de..4eb06692 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -74,7 +74,7 @@ class StatusBar(Widget):
             self.fm.thisfile.load_if_outdated()
             try:
                 ctime = self.fm.thisfile.stat.st_ctime
-            except:
+            except Exception:
                 ctime = -1
         else:
             ctime = -1
@@ -128,7 +128,7 @@ class StatusBar(Widget):
 
             try:
                 self.addnstr(0, starting_point, string, space_left)
-            except:
+            except Exception:
                 break
             space_left -= len(string)
             starting_point += len(string)
@@ -147,7 +147,7 @@ class StatusBar(Widget):
                 return
         try:
             stat = target.stat
-        except:
+        except Exception:
             return
         if stat is None:
             return
@@ -169,7 +169,7 @@ class StatusBar(Widget):
             how = target.exists and 'good' or 'bad'
             try:
                 dest = readlink(target.path)
-            except:
+            except Exception:
                 dest = '?'
             left.add(' -> ' + dest, 'link', how)
         else:
diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py
index a4e091b2..af102539 100644
--- a/ranger/gui/widgets/titlebar.py
+++ b/ranger/gui/widgets/titlebar.py
@@ -75,7 +75,7 @@ class TitleBar(Widget):
                 else:
                     try:
                         self.fm.enter_dir(part.directory)
-                    except:
+                    except Exception:
                         pass
                 return True
         return False
diff --git a/ranger/gui/widgets/view_base.py b/ranger/gui/widgets/view_base.py
index f487d357..41a6bccf 100644
--- a/ranger/gui/widgets/view_base.py
+++ b/ranger/gui/widgets/view_base.py
@@ -46,7 +46,7 @@ class ViewBase(Widget, DisplayableContainer):
         if hasattr(self, 'pager') and self.pager.visible:
             try:
                 self.fm.ui.win.move(self.main_column.y, self.main_column.x)
-            except:
+            except Exception:
                 pass
         else:
             try:
@@ -54,7 +54,7 @@ class ViewBase(Widget, DisplayableContainer):
                 y = self.main_column.y + self.main_column.target.pointer\
                         - self.main_column.scroll_begin
                 self.fm.ui.win.move(y, x)
-            except:
+            except Exception:
                 pass
 
     def _draw_bookmarks(self):
@@ -117,7 +117,7 @@ class ViewBase(Widget, DisplayableContainer):
                 self.wid)
         try:
             self.win.chgat(ystart - 1, 0, curses.A_UNDERLINE)
-        except:
+        except Exception:
             pass
         whitespace = " " * self.wid
         i = ystart
@@ -139,7 +139,7 @@ class ViewBase(Widget, DisplayableContainer):
                     self.fm.settings.use_preview_script:
                 try:
                     result = not self.fm.previews[target.realpath]['foundpreview']
-                except:
+                except Exception:
                     return self.old_collapse
 
         self.old_collapse = result
diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py
index b7cc07a6..7d0d26e1 100644
--- a/ranger/gui/widgets/view_miller.py
+++ b/ranger/gui/widgets/view_miller.py
@@ -148,7 +148,7 @@ class ViewMiller(ViewBase):
                 win.vline(1, x, curses.ACS_VLINE, y - 1)
                 self.addch(0, x, curses.ACS_TTEE, 0)
                 self.addch(y, x, curses.ACS_BTEE, 0)
-            except:
+            except Exception:
                 # in case it's off the boundaries
                 pass
 
@@ -175,7 +175,7 @@ class ViewMiller(ViewBase):
                     self.fm.settings.use_preview_script:
                 try:
                     result = not self.fm.previews[target.realpath]['foundpreview']
-                except:
+                except Exception:
                     return self.old_collapse
 
         self.old_collapse = result