XBEE Data read through serial port

Hi. I’ve used Xbee pro s1 for my project.

Tx sends data to receiver and the data is transferred through serial interface device
like ICStation’s mini adapter or NERO XBEE EXPLORER(without arduino or sth).

Problem is after quit python program(handles received data),
I must pull out xbee connector from my laptop and re-connect it to read the data.

I use MacBook Pro (Retina, 15-inch, Mid 2015), and os version is 10.11.6(El Capitan)
& use spyder 3.2.4 for ide.
(Same problem occurred on High-Sierra so I downgraded but same thing happens)

Test code is below

ser = serial.Serial(“/dev/cu.usbserial-DA1D4B4P”) # my usbserial port

ser.close()
time.sleep(0.5)
ser.open()

while True :
print(ser.read())

It works well for the first time I execute above program,
but after that, there’s no response from the device.

Every time I stop the current command when there is no response,
stop at the sequence below

ready, _, _ = select.select([self.fd, self.pipe_abort_read_r], [], [], timeout.time_left())

There’s no difference with or without FTDI driver.
Is there any suggestion to solve this problem?

Best regards

This is not an XBee issue but an issue with how your code utilizes the COM port. You may be better suited to post the question on a Programmers web site for the language you are working with.