diff options
author | terryjreedy <tjreedy@udel.edu> | 2017-06-14 01:32:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-14 01:32:16 (GMT) |
commit | 188aedf8bb623d41302e10503268b0852ea91134 (patch) | |
tree | f952fe1c581016248917d03f6e6cda1c87fb26fc /Lib/idlelib/run.py | |
parent | 8f6eeaf21cdf4aea25fdefeec814a1ce07453fe9 (diff) | |
download | cpython-188aedf8bb623d41302e10503268b0852ea91134.zip cpython-188aedf8bb623d41302e10503268b0852ea91134.tar.gz cpython-188aedf8bb623d41302e10503268b0852ea91134.tar.bz2 |
bpo-25514: Improve IDLE's connection refused message (#2177)
When IDLE fail to start because the socket connection fails, direct people to a new subsection of the IDLE doc listing various causes and remedies.
Diffstat (limited to 'Lib/idlelib/run.py')
-rw-r--r-- | Lib/idlelib/run.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 12c339f..9f6604b 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -180,19 +180,16 @@ def manage_socket(address): server.handle_request() # A single request only def show_socket_error(err, address): + "Display socket error from manage_socket." import tkinter - import tkinter.messagebox as tkMessageBox + from tkinter.messagebox import showerror root = tkinter.Tk() root.withdraw() - if err.args[0] == 61: # connection refused - msg = "IDLE's subprocess can't connect to %s:%d. This may be due "\ - "to your personal firewall configuration. It is safe to "\ - "allow this internal connection because no data is visible on "\ - "external ports." % address - tkMessageBox.showerror("IDLE Subprocess Error", msg, parent=root) - else: - tkMessageBox.showerror("IDLE Subprocess Error", - "Socket Error: %s" % err.args[1], parent=root) + msg = f"IDLE's subprocess can't connect to {address[0]}:{address[1]}.\n"\ + f"Fatal OSError #{err.errno}: {err.strerror}.\n"\ + f"See the 'Startup failure' section of the IDLE doc, online at\n"\ + f"https://docs.python.org/3/library/idle.html#startup-failure" + showerror("IDLE Subprocess Error", msg, parent=root) root.destroy() def print_exception(): |