diff -r f8371a2dd08f -r ca835b2c0f53 src/eric7/DebugClients/Python/DebugClientBase.py --- a/src/eric7/DebugClients/Python/DebugClientBase.py Tue Oct 22 17:49:41 2024 +0200 +++ b/src/eric7/DebugClients/Python/DebugClientBase.py Wed Oct 23 14:14:04 2024 +0200 @@ -2042,9 +2042,13 @@ else (socket.AF_INET if version == "v4" else socket.AF_INET6) ) - with contextlib.suppress(OSError): + try: addrinfo = socket.getaddrinfo(host, None, family, socket.SOCK_STREAM) return addrinfo[0][4][0] + except OSError: + # Did not resolve via this method. Return the host name and let Python3 + # try when connecting. + return host return None @@ -2068,16 +2072,13 @@ while args[0]: if args[0] == "-h": host = args[1] - del args[0] - del args[0] + del args[:2] elif args[0] == "-p": port = int(args[1]) - del args[0] - del args[0] + del args[:2] elif args[0] == "-w": wd = args[1] - del args[0] - del args[0] + del args[:2] elif args[0] == "-t": tracePython = True del args[0] @@ -2101,12 +2102,10 @@ del args[0] elif args[0] in ("-c", "--code"): codeStr = args[1] - del args[0] - del args[0] + del args[:2] elif args[0] in ("-m", "--module"): scriptModule = args[1] - del args[0] - del args[0] + del args[:2] elif args[0] == "--": del args[0] break @@ -2184,6 +2183,9 @@ remoteAddress = ipOrHost else: remoteAddress = self.__resolveHost(ipOrHost) + if remoteAddress is None: + print(f"Remote host '{ipOrHost}' could not be resolved.") # noqa: M801 + sys.exit(1) sys.argv = [""] if "" not in sys.path: @@ -2206,8 +2208,8 @@ self.connectDebugger(port, remoteAddress, redirect) self.__interact() else: - print("No network port given. Aborting...") - # __IGNORE_WARNING_M801__ + print("No network port given. Aborting...") # noqa: M801 + sys.exit(2) def close(self, fd): """