Update main.py

read/write fix