I need to communicate with Python over a USB to RS-232 converter, to a device. The application minicom connects seamlessly, so if I could run that in non-interactive mode, everything would would be great.Reading the documentation there are some interesting options, but I'm not fully understanding any one of them: -t   Terminal type. With this flag, you can override the environment       TERM variable.  -S   script.   Run  the named script at startup.How do I pipe data between my application and minicom? Should I use something else?
How do you use minicom with stdin and stdout?
usb;python;serial port;minicom
minicom is great for interactive use, but it's not the right tool for programmatic I/O.Your local Python program should simply open the /dev node for the serial port. It works just like writing to a file:fd = os.open('/dev/ttyUSB0', os.O_RDWR)fd.write(...)The only tricky bit is setting up the bit rate and such. For that, use Python's termios library:attr = termios.tcgetattr(fd)attr[5] = attr[6] = termios.B9600termios.tcsetattr(fd, termios.TCSANOW, attr)The Python docs for this pretty much assume you've used this API from C and just need help translating to Python. So, if you go down this path, you should use classics like Stevens and Rago's Advanced Programming in the Unix Environment.A higher-level library that gets you above the termios level and gives you portability to non-*ix type systems is pySerial.