title: How to simulate sys.argv[1:] on web based python
body: <p>I have a Python program where the initiation script looks like this:</p>
  
  <pre><code>if __name__ == "__main__":
      main(sys.argv[1:])
  </code></pre>
  
  <p>To run this, I have to use Shell or Terminal like this:</p>
  
  <pre><code>myscript somefile.xml
  </code></pre>
  
  <p>The script accepts a file and then does all the rest of the work.
  Now, I am trying to run this program on a web server.</p>
  
  <p>SO I use a HTML Form to submit the file to this script.
  In my Python script, I am doing like this:</p>
  
  <pre><code>....
  elif req.form.has_key("filename"):
      item=req.form["filename"]
      if item.file:
          req.write("I GO HERE")
          myscript.main(item)
  ....
  </code></pre>
  
  <p>As you can see here, I am trying to send the file directly to the "main" function.
  Is this the right way to do?</p>
  
  <p>I dont get any script error, but the Python script is not producing the expected results.</p>
  
  <p>Any help?
  Thanks</p>