Thanks a lot Jeremy, you have made things clearer and now i can get past that line in the command line without being told of a syntax error. However now i get:<div><br></div><div><div>     raise Exception(&#39;Invalid argument count&#39;)</div>
<div>Exception: Invalid argument count</div><div><br></div><div>this is the script so far:</div><div><br></div><div><div>#!/usr/bin/env python</div><div><br></div><div>import sys</div><div>import os</div><div><br></div><div>
if len(sys.argv) != 3:</div><div>    raise Exception(&#39;Invalid argument count&#39;)</div><div>chanid, starttime = sys.argv[1:3]</div><div><br></div><div>from MythTV import MythBE, findfile</div><div>be = MythBE()</div>
<div>prog = be.getRecording(chanid, starttime)</div><div>oldbase = prog.basename.rsplit(&#39;.&#39;,1)[0]</div><div>newbase = prog.formatPath(&#39;%m-%d_%H-%i-%s_%cN_%T&#39;).rsplit(&#39;.&#39;,1)[0]</div><div>sg = findfile(prog.basename, prog.storagegroup)</div>
<div>if sg is None:</div><div>    raise Exception(&#39;file not found&#39;)</div><div><br></div><div>from MythTV import System</div><div>ccextractor = System(path=&quot;/home/dave/uksub2srt/uksub2srt.py&quot;)</div><div>ccextractor(&#39;-i&#39;, os.path.join(sg.dirname, prog.basename),</div>
<div>            &#39;-o&#39;, &#39;/home/subtitles/{0}.srt&#39;.format(newbase))</div></div><div><br></div><br><div class="gmail_quote">On 3 February 2012 20:00, Jeremy Jones <span dir="ltr">&lt;<a href="mailto:jeremy.dwain.jones@gmail.com">jeremy.dwain.jones@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">David,<div><br></div><div>I am also a novice at python, so I can empathize.  </div><div><br></div><div>Remember that when you are learning new code: <u><i><b>search engines are your friend</b></i></u>.  I googled:&quot;python sys.argv list&quot; and the second link produced this: <a href="http://stackoverflow.com/questions/2626026/python-sys-argv-lists-and-indexes" target="_blank">http://stackoverflow.com/questions/2626026/python-sys-argv-lists-and-indexes</a> which explains what the line code below is doing very well.</div>
<div class="im">
<div><br></div><div>  <span>chanid, starttime = sys.argv[1:3]</span></div><div><br></div></div><div>I still did not understand why Raymond told you use [1:3] to populate two variables, so I again went to google with the search, &quot;python use of colon in list&quot;.  The second item listed was: <a href="http://stackoverflow.com/questions/4012340/python-colon-in-list-index" target="_blank">http://stackoverflow.com/questions/4012340/python-colon-in-list-index</a></div>

<div><br></div><div>Now I know from reading that page that the list is using items1 to 3, but not including 3.  The items you passed from the command line were what you want for input as the channel Id and the start time.  The command:</div>
<div class="im">
<div><br></div><div><span>  chanid, starttime = sys.argv[1:3]</span>
</div><div><span><br></span></div></div><div><span>is storing those passed parameters into variables named:</span></div><div><span>chanid</span></div><div><span>starttime</span></div><div><span><br>
</span></div><div><span>Therefore the line:</span></div><div class="im"><div><span>  prog = be.getRecording(&lt;chanid&gt;, &lt;be&gt;)</span>
</div><div><span><br></span></div></div><div><span>should be:</span></div><div><span>prog = be.getRecording(chanid, starttime)</span></div><div><span><br></span></div><div><span>What Raymond was telling you about the brackets &quot;&lt; &gt;&quot; was that they are generic placeholders for which one would insert the required information into that function call, not an actual part of the syntax of the code.  Since you are passing that information from the command line, and not &quot;hard coding&quot; it in the script, you need to use the same variables that were used to store that information from the command line.</span></div>
<span class="HOEnZb"><font color="#888888">
<div><span><br></span></div><div><font color="#222222" face="arial, sans-serif"><br></font></div><div><span>Jeremy</span></div><div><span><br></span></div><div><span><br></span></div><div><span><br>
</span></div><div><span><br></span></div>
</font></span><br>_______________________________________________<br>
mythtv-users mailing list<br>
<a href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>
<a href="http://www.mythtv.org/mailman/listinfo/mythtv-users" target="_blank">http://www.mythtv.org/mailman/listinfo/mythtv-users</a><br>
<br></blockquote></div><br></div>