Filename passed as commandline argument to use inside os.open() in Python
<p>I want to get a file name as a command line argument and want to use it in the <code>os.popen</code> command in Python. But when I use <code>sys.argv[1]</code> inside a command, it shows a error. How can I use the filename passed as a command line argument in a command?</p>

<p>Code:</p>

<pre><code>import os
import sys
if len(sys.argv) != 2:
    print 'usage speech2text.py filename'
    exit(1)
s=sys.argv[1]
os.popen('ffmpeg -i sys.argv[1] -vn -ar 44100 -ac 2 -ab 192 -f flac SamplE.flac')
os.popen('python speech2text.py ../../../../audio/SamplE.flac')
</code></pre>

<p>Error:</p>

<pre><code>error sys.argv[1]: No such file or directory
</code></pre>
