---
# System prepended metadata

title: Mu 開啟文件時發生讀取錯誤解決方法

---

# Mu 開啟文件時發生讀取錯誤解決方法

在 `AppData\Local\Programs\Mu Editor\Python\Lib\site-packages\mu\contrib` 中找到 `microfs.py`，並在`flush(serial)`後方添加延時（至少0.5s）：

``` python=
def flush(serial):
        """Flush all rx input without relying on serial.flushlnput()."""
        n = serial.inWaiting()
        while n > 0:
            serial.read(n)
            n = serial.inWaiting()

raw_repl_msg = b'raw REPL; CTRL-B to exit\r\n>'
#  Send CTRL-B to end raw mode if required
serial.write(b'\x02')
#  Send CTRL-C three times between pauses to break out of loop
for i in range(3):
    serial.write(b'\r\x03')
    time.sleep(0.01)
flush(serial)
#此處添加延時大於0.5s
time.sleep(2)
#  Go into raw mode with CTRL-A.
serial.write(b'\r\x01')

#後略
```