How to pass escaped string to shell script in Python
<p>I am attempting to create a Python script that in turn runs the shell script "js2coffee" to convert some javascript into coffeescript. </p>

<p>From the command line I can run this, and get coffeescript back again...</p>

<p><code>echo "var myNumber = 100;" | js2coffee</code></p>

<p>What I need to do is use this same pattern from Python.</p>

<p>In Python, I've come to something like this:</p>

<pre><code>command = "echo '" + myJavscript + "' | js2coffee"
result = os.popen(command).read()
</code></pre>

<p>This works sometimes, but there are issues related to special characters (mostly quotes, I think) not being properly escaped in the <code>myJavascript</code>. There has got to be a standard way of doing this. Any ideas? Thanks!</p>
