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)
How about os.write(<file descriptor>, os.linesep)? (import os is unnecessary because you seem to have already imported it, otherwise you'd be getting errors using os.write to begin with.)
os.write(<file descriptor>, os.linesep)
import os