#!/usr/bin/env python import socket from time import sleep from rich.console import Console console = Console() print = console.print with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock: sock.connect('/run/example.sock') with console.status('Connected...'): while True: try: sleep(0.1) except KeyboardInterrupt: break