| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3b83c02 commit 3cfda64
10 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -168,7 +168,7 @@ def flush(self): | |||
| 168 | 168 | def write(self, value): | |
| 169 | 169 | # XXX IPython expects sys.stdin.write to exist, there will no doubt be | |
| 170 | 170 | # others, so here's a hack to keep them happy | |
| 171 | - raise IOError(errno.EBADF, "sys.stdin is read-only") | ||
| 171 | + raise OSError(errno.EBADF, "sys.stdin is read-only") | ||
| 172 | 172 | ||
| 173 | 173 | def isatty(self): | |
| 174 | 174 | return True | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -268,7 +268,7 @@ def get_key_no_doublebind(command): | |||
| 268 | 268 | ) | |
| 269 | 269 | try: | |
| 270 | 270 | load_theme(struct, path, struct.color_scheme, default_colors) | |
| 271 | - except EnvironmentError: | ||
| 271 | + except OSError: | ||
| 272 | 272 | sys.stderr.write( | |
| 273 | 273 | f"Could not load theme '{color_scheme_name}'.\n" | |
| 274 | 274 | ) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -198,7 +198,7 @@ def flush(self): | |||
| 198 | 198 | def write(self, value): | |
| 199 | 199 | # XXX IPython expects sys.stdin.write to exist, there will no doubt be | |
| 200 | 200 | # others, so here's a hack to keep them happy | |
| 201 | - raise IOError(errno.EBADF, "sys.stdin is read-only") | ||
| 201 | + raise OSError(errno.EBADF, "sys.stdin is read-only") | ||
| 202 | 202 | ||
| 203 | 203 | def close(self): | |
| 204 | 204 | # hack to make closing stdin a nop | |
@@ -666,7 +666,7 @@ def process_control_event(self, e): | |||
| 666 | 666 | elif isinstance(e, bpythonevents.RunStartupFileEvent): | |
| 667 | 667 | try: | |
| 668 | 668 | self.startup() | |
| 669 | - except IOError as e: | ||
| 669 | + except OSError as e: | ||
| 670 | 670 | self.status_bar.message( | |
| 671 | 671 | _("Executing PYTHONSTARTUP failed: %s") % (e,) | |
| 672 | 672 | ) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -80,7 +80,7 @@ def acquire(self): | |||
| 80 | 80 | try: | |
| 81 | 81 | fcntl.flock(self.fileobj, self.mode) | |
| 82 | 82 | self.locked = True | |
| 83 | - except IOError as e: | ||
| 83 | + except OSError as e: | ||
| 84 | 84 | if e.errno != errno.ENOLCK: | |
| 85 | 85 | raise e | |
| 86 | 86 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -221,7 +221,7 @@ def append_reload_and_write(self, s, filename, encoding): | |||
| 221 | 221 | self.save_to(hfile, entries, self.hist_size) | |
| 222 | 222 | ||
| 223 | 223 | self.entries = entries | |
| 224 | - except EnvironmentError as err: | ||
| 224 | + except OSError as err: | ||
| 225 | 225 | raise RuntimeError( | |
| 226 | 226 | _("Error occurred while writing to file %s (%s)") | |
| 227 | 227 | % (filename, err.strerror) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -136,7 +136,7 @@ def find_modules(path): | |||
| 136 | 136 | ||
| 137 | 137 | try: | |
| 138 | 138 | filenames = os.listdir(path) | |
| 139 | - except EnvironmentError: | ||
| 139 | + except OSError: | ||
| 140 | 140 | filenames = [] | |
| 141 | 141 | ||
| 142 | 142 | finder = importlib.machinery.FileFinder(path) | |
@@ -172,7 +172,7 @@ def find_modules(path): | |||
| 172 | 172 | is_package = True | |
| 173 | 173 | else: | |
| 174 | 174 | pathname = spec.origin | |
| 175 | - except (ImportError, IOError, SyntaxError): | ||
| 175 | + except (ImportError, OSError, SyntaxError): | ||
| 176 | 176 | continue | |
| 177 | 177 | except UnicodeEncodeError: | |
| 178 | 178 | # Happens with Python 3 when there is a filename in some | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -164,7 +164,7 @@ def fixlongargs(f, argspec): | |||
| 164 | 164 | keys = argspec[0][-len(values) :] | |
| 165 | 165 | try: | |
| 166 | 166 | src = inspect.getsourcelines(f) | |
| 167 | - except (IOError, IndexError): | ||
| 167 | + except (OSError, IndexError): | ||
| 168 | 168 | # IndexError is raised in inspect.findsource(), can happen in | |
| 169 | 169 | # some situations. See issue #94. | |
| 170 | 170 | return | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,7 +58,7 @@ def page(data, use_internal=False): | |||
| 58 | 58 | # pager command not found, fall back to internal pager | |
| 59 | 59 | page_internal(data) | |
| 60 | 60 | return | |
| 61 | - except IOError as e: | ||
| 61 | + except OSError as e: | ||
| 62 | 62 | if e.errno != errno.EPIPE: | |
| 63 | 63 | raise | |
| 64 | 64 | while True: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -445,7 +445,7 @@ def __init__(self, interp, config): | |||
| 445 | 445 | self.rl_history.load( | |
| 446 | 446 | pythonhist, getpreferredencoding() or "ascii" | |
| 447 | 447 | ) | |
| 448 | - except EnvironmentError: | ||
| 448 | + except OSError: | ||
| 449 | 449 | pass | |
| 450 | 450 | ||
| 451 | 451 | self.completers = autocomplete.get_default_completer( | |
@@ -660,7 +660,7 @@ def get_source_of_current_name(self): | |||
| 660 | 660 | return inspection.get_source_unicode(obj) | |
| 661 | 661 | except (AttributeError, NameError) as e: | |
| 662 | 662 | msg = _("Cannot get source: %s") % (e,) | |
| 663 | - except IOError as e: | ||
| 663 | + except OSError as e: | ||
| 664 | 664 | msg = f"{e}" | |
| 665 | 665 | except TypeError as e: | |
| 666 | 666 | if "built-in" in f"{e}": | |
@@ -857,7 +857,7 @@ def write2file(self): | |||
| 857 | 857 | try: | |
| 858 | 858 | with open(fn, mode) as f: | |
| 859 | 859 | f.write(stdout_text) | |
| 860 | - except IOError as e: | ||
| 860 | + except OSError as e: | ||
| 861 | 861 | self.interact.notify(_("Error writing file '%s': %s") % (fn, e)) | |
| 862 | 862 | else: | |
| 863 | 863 | self.interact.notify(_("Saved to %s.") % (fn,)) | |
@@ -1166,7 +1166,7 @@ def edit_config(self): | |||
| 1166 | 1166 | os.makedirs(containing_dir) | |
| 1167 | 1167 | with open(self.config.config_path, "w") as f: | |
| 1168 | 1168 | f.write(default_config) | |
| 1169 | - except (IOError, OSError) as e: | ||
| 1169 | + except OSError as e: | ||
| 1170 | 1170 | self.interact.notify( | |
| 1171 | 1171 | _("Error writing file '%s': %s") | |
| 1172 | 1172 | % (self.config.config.path, e) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -102,7 +102,7 @@ def git_describe_to_python_version(version): | |||
| 102 | 102 | with open(version_file) as vf: | |
| 103 | 103 | version = vf.read().strip().split("=")[-1].replace("'", "") | |
| 104 | 104 | version = version.strip() | |
| 105 | - except IOError: | ||
| 105 | + except OSError: | ||
| 106 | 106 | pass | |
| 107 | 107 | ||
| 108 | 108 | with open(version_file, "w") as vf: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments