pyserial到ajax php jquery javascript

pyserial到ajax php jquery javascript,javascript,php,jquery,ajax,pyserial,Javascript,Php,Jquery,Ajax,Pyserial,这是一个高层次的问题。我有硬件每3秒钟生成一次串行数据。我使用PySerial脚本读取端口并将数据写入文本文件 ser = serial.Serial( port='COM3', baudrate=2400, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.SEVENBITS ) array = []; while True: message

这是一个高层次的问题。我有硬件每3秒钟生成一次串行数据。我使用PySerial脚本读取端口并将数据写入文本文件

    ser = serial.Serial(
    port='COM3',
    baudrate=2400,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    bytesize=serial.SEVENBITS
)

array = [];
while True:
    message = ser.read();
        fo = open("../wamp/www/amt/test5.txt", "w")
        fo.write(message);
        array = [];
        fo.close()
这不是整个脚本,但代表了我正在做的事情。然后,web应用程序使用ajax$.GET调用从文本文件检索数据。然后我可以让数据为我跳舞。(数据喜欢跳舞)

问题是,在5小时到2天之间的任何地方,系统都会停止工作。没有反馈。唯一可以修复它的是更改文本文件的名称

    ser = serial.Serial(
    port='COM3',
    baudrate=2400,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    bytesize=serial.SEVENBITS
)

array = [];
while True:
    message = ser.read();
        fo = open("../wamp/www/amt/test5.txt", "w")
        fo.write(message);
        array = [];
        fo.close()
我假设我正在达到文本文件读写的极限。另一种理论是,我的内存使用量达到了最大值,软件出现了故障。你怎么认为?如何更永久地修复此问题