altdesktop / i3ipc-python

🐍 An improved Python library to control i3wm and sway.
http://i3ipc-python.readthedocs.io
BSD 3-Clause "New" or "Revised" License
851 stars 109 forks source link

Exception: Failed to retrieve the i3 or sway IPC socket path (running default example) #161

Closed santiagodemierre closed 4 years ago

santiagodemierre commented 4 years ago

Exception Traceback (most recent call last)

in 3 # Create the Connection object that can be used to send commands and subscribe 4 # to events. ----> 5 i3 = Connection() 6 7 # Print the name of the focused window ~/.local/lib/python3.6/site-packages/i3ipc/connection.py in __init__(self, socket_path, auto_reconnect) 66 67 if not socket_path: ---> 68 raise Exception('Failed to retrieve the i3 or sway IPC socket path') 69 70 if auto_reconnect: Exception: Failed to retrieve the i3 or sway IPC socket path
santiagodemierre commented 4 years ago

This solves it: connection.py

if not socket_path: socket_path = str(subprocess.check_output("i3 --get-socketpath",shell=True).decode().strip())

acrisci commented 4 years ago

Unfortunately I eat the error that would tell you why that failed. I need to add better logging.

acrisci commented 4 years ago

I also need to add the logic to get it from the binary if the other methods fail.

acrisci commented 4 years ago

I've added logging and the alternative socket path finding mechanism. This should be fixed.