I need to implement an external application to calculate CRC values for Modbus communication. The executable requires an input string and gives back output like this:
CRC16 = 0x67ED / 26605
CRC16 (Modbus) = 0x7CED / 31981
I call the programm and afterwards type in the input manually.
p = Popen(["some_file.exe", "-x"], stdin=PIPE)
p.communicate("some_string")
This is working fine so far.
However, I want to save the output to a variable or something (no extra file) for further uses.
I know there are the stdout and stderr arguments, but when typing
p = Popen([file, "-x"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
nothing happens at all.
Does anyone has an idea what to do?
Thanks in advance.
PS: Using Python 2.7 on Windows 7.