mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
8f6eeaf21c
commit
188aedf8bb
4 changed files with 119 additions and 35 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue