function createPythonProcess() {
  let pythonScriptPath = getPythonServerPath()
  let port = '' + selectPort()

  if (guessPackaged()) { // If the app has been packaged, use execFile instead of spawn
    pythonProcess = require('child_process').execFile(pythonScriptPath, [port])
  } else {
    pythonProcess = require('child_process').spawn('python', [pythonScriptPath, port])
  }

  // Print stdout and stderr to console
  pythonProcess.stdout.on('data', (data) => {
    console.log(`stdout: ${data}`)
  })

  pythonProcess.stderr.on('data', (data) => {
    console.log(`stderr: ${data}`)
  })

  pythonProcess.on('close', (code) => {
    console.log(`child process exited with code ${code}`)
  })

  return pythonProcess
}
/**
 * Creates and spawns the python server as a child process of the Node.js application
 * @returns The child process containing the python server
 */
Creates and spawns the python server as a child process of the Node.js application
@returns The child process containing the python server
Creates and spawns the python server as a child process of the Node . js application @returns The child process containing the python server
function createPythonProcess() {
  let pythonScriptPath = getPythonServerPath()
  let port = '' + selectPort()
  if (guessPackaged()) { 
    pythonProcess = require('child_process').execFile(pythonScriptPath, [port])
  } else {
    pythonProcess = require('child_process').spawn('python', [pythonScriptPath, port])
  }
  pythonProcess.stdout.on('data', (data) => {
    console.log(`stdout: ${data}`)
  })
  pythonProcess.stderr.on('data', (data) => {
    console.log(`stderr: ${data}`)
  })
  pythonProcess.on('close', (code) => {
    console.log(`child process exited with code ${code}`)
  })
  return pythonProcess
}
function createPythonProcess ( ) { let pythonScriptPath = getPythonServerPath ( ) let port = '' + selectPort ( ) if ( guessPackaged ( ) ) { pythonProcess = require ( 'child_process' ) . execFile ( pythonScriptPath , [ port ] ) } else { pythonProcess = require ( 'child_process' ) . spawn ( 'python' , [ pythonScriptPath , port ] ) } pythonProcess . stdout . on ( 'data' , ( data ) => { console . log ( ` ${ data } ` ) } ) pythonProcess . stderr . on ( 'data' , ( data ) => { console . log ( ` ${ data } ` ) } ) pythonProcess . on ( 'close' , ( code ) => { console . log ( ` ${ code } ` ) } ) return pythonProcess }
Creates and spawns the python server as a child process of the Node.js application
 @returns The child process containing the python server
Creates and spawns the python server as a child process of the Node . js application @returns The child process containing the python server
// If the app has been packaged, use execFile instead of spawn // Print stdout and stderr to console