so I am trying to send over serialized protobuf messages over SSH and deserialize them on my local machine. However, for some reason when I send over the serialized string, I get a DecodeError saying that I am trying to deserialize a Truncated Message.
The way I have this setup is I have two scripts, one being run on the server through Popen and ssh on my local script. The script being run on the server is simply printing the message.SerializeToString() to stdout and then I am collecting that output through Popen.stdout on my local script. Here are some code snippets:
Local Machine Script:
magic_str = 'this_is_magical'
ssh = subprocess.Popen('ssh xxx.xxx.xxx.xxx logsearch.py', stdout=subprocess.PIPE)
for line in ssh.stdout:
#this is just the specific protobuf message structure I created
l = log_pb2.LogLine()
#restore the internal newlines, discussed below
l.ParseFromString(line.replace(magic_str, '\n'))
Server Script (logsearch.py):
#get some LogLine object named l, and we replace the internal newlines with
#magic_str because it messes up reading line by line in the local script
magic_str = 'this_is_magical'
print l.SerializeToString().replace('\n', magic_str)
Thank you in advance for any help you can provide me with, it is much appreciated. If any extra information is needed or if anything is unclear, please let me know and I will make sure to clarify.