title: Electron/Node.js - How to spawn a python script from another directory
body: <p>I currently have the following file structure for my electron project:</p>
  
  <pre><code>&lt;PROJECT&gt;
        &lt;css&gt;
        &lt;js&gt;
        &lt;data&gt;
        &lt;scripts&gt;
              script.py
        index.html
        main.js
        package.json
  </code></pre>
  
  <p>In my <code>main.js</code> I have </p>
  
  <pre><code>var ipc = require('electron').ipcMain;
  
  ipc.on('asynchronous-message', function (event, arg) {
      var py = require('child_process').spawn('python', ['./scripts/script.py']);
      py.on('close', function() {
          event.sender.send('asynchronous-reply', '');
      });
  });
  </code></pre>
  
  <p>But the python script (which actually generates an output file) doesn't seem to run at all. If I take the script out of the <code>scripts</code> folder and place it in the top level folder right next to the <code>main.js</code> file and change the <code>spawn</code> agruments array to <code>['./script.py']</code>, it runs perfectly fine. I'm just not entirely sure what part of the code above is causing the script to fail to execute.</p>