title: Pass base64 strings from node.js to a python subprocess through stdin and access the strings on python side
body: <p>I am trying to pass data from node.js to a python subprocess called using spawn module, the data are 2 base64 strings.</p>
  
  <p>I think i am already passing the data correctly to python but i dont know how to access them in the python side.</p>
  
  <ol>
  <li>How do i access the base64 string as string ? </li>
  <li>How do i access each string individually ?</li>
  </ol>
  
  <p><strong>Node.js code:</strong></p>
  
  <pre><code>async mainOcrScript({request}) {
  
      const front_img = request.front_img_b64
      const back_img = request.back_img_b64
      const debug_mode = request.debug_mode
      const lang = request.lang
  
      const process =
        await spawn('python3', [Helpers.resourcesPath('pythonScripts/main.py'),
        debug_mode,
        lang
      ]);
  
      process.stdin.write(front_img); // base64 string
      process.stdin.write(back_img); // base64 string
  
      process.stdin.end();
  
      process.stdout.on('data', (data) =&gt; {
        console.log(data);
      });
  
      process.stderr.on('data', (data) =&gt; {
        console.log(data);
      });
  
      process.on('exit', (code) =&gt; {
        console.log("Process quit with code : " + code);
      });
  }
  </code></pre>
  
  <p><strong>Python main.py:</strong></p>
  
  <pre><code>if __name__ == '__main__':
  
      print(sys.stdin)
  
      # How do i access front_img and back_img variables that i had on node.js ? 
  
      sys.exit()
  
      main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
  </code></pre>
  
  <p><strong>When i do:</strong></p>
  
  <pre><code>    print(sys.stdin.read())
  </code></pre>
  
  <p>All i get is a bunch Buffer lines.</p>
  
  <p>Thank you.</p>