Handle pty unavailability on windows

Wrapped the pty import in a try except block