well I don't know about your `ino` program, but here's how I'd do it: get_serial.py import serial, sys with serial.Serial(port=sys.argv[1], baudrate=sys.argv[2]) as ser: while ser.isOpen(): print(ser.readline()) the idea, here, is to print on stdout the data coming on the serial line: python get_serial.py /dev/ttyACM0 115200 > output.log or you can do it this way: get_serial.py import serial, sys with open(sys.argv[3]) as f: with serial.Serial(port=sys.argv[1], baudrate=sys.argv[2]) as ser: while ser.isOpen(): f.write(ser.readline()) which is ran: python get_serial.py /dev/ttyACM0 115200 output.log HTH