The os.write function can be used to writes bytes into a file descriptor (not file object). If I execute os.write(fd, \'\\n\'), o
os.write
os.write(fd, \'\\n\')
Use this
import os os.write(fd, os.linesep)