changed all unix-only dependencies

There were several locations with unix-only dependencies. These were
causing errors when running in a windows console. Wrapped all of these
with try logic. Now it all runs in windows without any errors.
I think if we change the below code to `os.read(fileno, 0)` we don't need this.
It means we don't handle partial messages, but we already weren't handling that.