summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/run.py
diff options
context:
space:
mode:
authorterryjreedy <tjreedy@udel.edu>2017-06-14 02:13:15 (GMT)
committerGitHub <noreply@github.com>2017-06-14 02:13:15 (GMT)
commit22d909f8c24bd7768df1a5bf0e52c597ea947cfb (patch)
tree6414eb5943805b3900b19887c7b85750e7aa6cc2 /Lib/idlelib/run.py
parentd92ee3ea622b6eee5846681bad5595cfedcf20b6 (diff)
downloadcpython-22d909f8c24bd7768df1a5bf0e52c597ea947cfb.zip
cpython-22d909f8c24bd7768df1a5bf0e52c597ea947cfb.tar.gz
cpython-22d909f8c24bd7768df1a5bf0e52c597ea947cfb.tar.bz2
[3.6]bpo-25514: Improve IDLE's connection refused message (#2177) (#2178)
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. (cherry picked from commit 188aedf8bb623d41302e10503268b0852ea91134)
Diffstat (limited to 'Lib/idlelib/run.py')
-rw-r--r--Lib/idlelib/run.py17
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():