Using Chrome Nationwide Messages an example application as a template can make a bash system call
os.system("<bash command>")
Requirement - return base64 string from python script
os.system("<bash command that returns a base64 string>")
which can check the expected return result in terminal .
However, when setting up the code in native-messaging-example-host on lines 97-98 on
dataurl = os.system("<bash command that returns a base64 string>") text = '{"text": "' + dataurl + '"}'
the application window closes and
Failed to connect: Error when communicating with the native messaging host.
printed on the HTML application page.
When using the source code
text = '{"text": "' + self.messageContent.get() + '"}'
and sending the base64 string corresponding to the output that the bash command outputs to the python host, base64 sent back to the client. The length of the base64 string being tested is 43304 , which is less than the maximum size of 1 MB messages sent from the host. The maximum number of messages sent from the host.
Why does the application throw an error and not send the base64 string from the python host to the Chromium client?
source share