Handle if file does not exist

This commit is contained in:
Fierelier 2023-03-28 20:40:45 +02:00
parent 5eac07bfe9
commit e6010080ac
1 changed files with 3 additions and 1 deletions

View File

@ -7,7 +7,9 @@ try: # See if socket already exists (A browser process is open)
s = socket.socket(socket.AF_UNIX,socket.SOCK_STREAM)
s.connect(socketFile)
except Exception: # Otherwise, make our own (No browser process is open)
os.remove(socketFile)
try:
os.remove(socketFile)
except: pass
s = socket.socket(socket.AF_UNIX,socket.SOCK_STREAM)
s.bind(socketFile)
s.listen(65535)