'Writing to a serial port

Using serial library on Windows.

I open a serial port successfully and then do a write() and it's never returning.

There is nothing on the other side reading the port

        s = serial.Serial()
        s.port = "COM3:"
        #s.timeout = 0.05
        #s.baudrate = 115200
        #s.parity =  serial.PARITY_NONE
        s.open()
        assert s.is_open

        print("A")
        s.write("XXX".encode())
        print("B")  # don't see this

The above code works once.

The second time it hangs on the write()



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source