title: Executing Python Script from NodeJS/Express instance using a relative URL
body: <p>I am developing a web app that relies on NodeJS and the Express module in which I am trying to run a Python script from an express route. What I would like to do is store the Python script in <code>/public/scripts/test.py</code> and refer to it using a relative URL such as <code>/scripts/test.py</code> so that Node doesn't need to know anything about the environment in which it is running.</p>
  
  <p>I've attempted to execute the Python script both by using the <a href="https://www.npmjs.org/package/python-shell" rel="nofollow">python-shell module</a> and by simply using Node's built-in <a href="http://nodejs.org/api/child_process.html" rel="nofollow">ChildProcess</a>. In both cases I'm running into the same issue – the path to the Python script seems to treated as being absolute and thus the script isn't executed, resulting in a file not found error.</p>
  
  <p>How can I go about invoking a Python script with a relative URL? I'm rather new to web development, so I would not be surprised if I was simply misunderstanding the situation.</p>
  
  <p>EDIT:
  As jfreind00 pointed out, process.cwd() can be used to identify the present working directory on top of which a URL to the script can be built. Worked like a charm.</p>