s/isfile/exists/ since Python doesn't regard a socket as a 'file'