def write(self, s):
        """Output the given string over the serial port."""
        if not self.hComPort: raise portNotOpenError
        #print repr(s),
        if s:
            err, n = win32file.WriteFile(self.hComPort, s, self._overlappedWrite)
            if err: #will be ERROR_IO_PENDING:
                # Wait for the write to complete.
                win32event.WaitForSingleObject(self._overlappedWrite.hEvent, win32event.INFINITE)