<br><br><div class="gmail_quote">On 4 February 2012 16:21, David Crawford <span dir="ltr">&lt;<a href="mailto:davidcrawford83@gmail.com">davidcrawford83@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">
<div class="HOEnZb"><div class="h5"><div><div><br></div><br><div class="gmail_quote">On 3 February 2012 23:35, Jeremy Jones <span dir="ltr">&lt;<a href="mailto:jeremy.dwain.jones@gmail.com" target="_blank">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">
On Fri, Feb 3, 2012 at 4:33 PM, David Crawford<br>
<div>&lt;<a href="mailto:davidcrawford83@gmail.com" target="_blank">davidcrawford83@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; On 3 February 2012 22:19, David Crawford &lt;<a href="mailto:davidcrawford83@gmail.com" target="_blank">davidcrawford83@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On 3 February 2012 22:17, Raymond Wagner &lt;<a href="mailto:raymond@wagnerrp.com" target="_blank">raymond@wagnerrp.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On 2/3/2012 17:12, David Crawford wrote:<br>
&gt;&gt;&gt; &gt;  bash: syntax error near unexpected token &#39;1010&#39;<br>
&gt;&gt;&gt;<br>
<br>
</div>Did you have the &lt; character in front of the 1010?  It would probably<br>
help if you were to actually post your entire command line instead of<br>
descriptions of what you did.<br>
<div><br>
<br>
&gt;&gt;&gt; If you are getting anything &quot;bash&quot;, it means that your &quot;hashbang&quot; is not<br>
&gt;&gt;&gt; configured properly, and your system is instead trying to run the script<br>
&gt;&gt;&gt; directly in whatever shell you are currently running (which seems to be<br>
&gt;&gt;&gt; Bash).<br>
<br>
</div>Maybe.  You know better than I do, but what if the bash error is in<br>
his command line and it never gets to the python script<br>
<br>
I did this in a bash shell just to test:<br>
jeremy@mythbox2011-03-25:~$ find_orphans.py &lt;1010&gt;<br>
<div>bash: syntax error near unexpected token `1010&#39;<br>
<br>
</div>Just to further drive home the point of the &lt;brackets&gt;:<br>
<br>
Those are indicators to you that the word or input that goes there is<br>
something you should fill in, and *****does not***** include the<br>
actual beginning &quot;&lt;&quot; or the ending &quot;&gt;&quot;.<br>
<div><br>
<br>
&gt;&gt;&gt; <a href="http://en.wikipedia.org/wiki/Shebang_%28Unix%29#Examples" target="_blank">http://en.wikipedia.org/wiki/Shebang_%28Unix%29#Examples</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; In the case of the jobqueue, it currently passes everything through the<br>
&gt;&gt;&gt; Bourne shell (/bin/sh), but the end result would be the same.<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; mythtv-users mailing list<br>
&gt;&gt;&gt; <a href="mailto:mythtv-users@mythtv.org" target="_blank">mythtv-users@mythtv.org</a><br>
&gt;&gt;&gt; <a href="http://www.mythtv.org/mailman/listinfo/mythtv-users" target="_blank">http://www.mythtv.org/mailman/listinfo/mythtv-users</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Wouldnt that prevent the other script from not working also?<br>
&gt;<br>
&gt; When running with &quot; &quot; for &quot;&lt;Chanid&gt;&quot;and &quot;&lt;starttime&gt;&quot;<br>
&gt;<br>
&gt; I instead get<br>
&gt;<br>
&gt; chanid, starttime = sys.arg[1:3]<br>
&gt; ValueError: need more than 1 value to unpack<br>
&gt;<br>
&gt;<br>
</div>This is good, it means the python interpreter is running the code<br>
here, but you only passed one value and it needed three.  The first<br>
value was the python script name which was passed to python as:<br>
sys.argv[0]<br>
<br>
the second:<br>
sys.argv[1]<br>
which is stored in the variable: chanid<br>
<br>
the third is:<br>
sys.argv[2]<br>
which is stored in the variable: starttime<br>
<span><font color="#888888"><br>
<br>
<br>
Jeremy<br>
</font></span><div><div>_______________________________________________<br>
mythtv-users mailing list<br>
<a href="mailto:mythtv-users@mythtv.org" target="_blank">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>
</div></div></blockquote></div><br></div></div></div><div>Hi,<div><br></div><div>This is the command ive tried + with &quot;&lt;&quot; also and without &quot;.py&quot;. You can see the error below.<br><br><div>dave@dave-virtual-machine:~/uksub2srt$ /home/dave/uksub2srt/renamesrt.py 1010 20120202234800</div>

<div>Traceback (most recent call last):</div><div>  File &quot;/home/dave/uksub2srt/rename.py&quot;, line 7, in &lt;module&gt;</div><div class="im"><div>    raise Exception(&#39;Invalid argument count&#39;)    </div><div>
Exception: Invalid argument count</div>
<div><br></div></div><div>Also, here is the script:</div><div><br></div><div><div>#!/usr/bin/python</div><div class="im"><div><br></div><div>import sys</div><div>import os</div><div><br></div><div>if len(sys.argv) != 2:</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><div>prog = be.getRecording(1001, 20111209212231)</div><div class="im"><div>oldbase = prog.basename.rsplit(&#39;.&#39;,1)[0]</div>

</div><div>newbase = prog.formatPath(&#39;%m-%d_%H-%i-%cN_%T&#39;).rsplit(&#39;.&#39;,1)[0]</div><div class="im"><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><div>
             &#39;-o&#39;, &#39;/home/dave/Downloads/subtitles/{0}.srt&#39;.format(newbase))</div>
</div></div></div><div><br></div>
</blockquote></div><br><div>Ok - so that error was down to having &quot;if len(sys.argv) != 2:&quot; and not !=3: - forgot to change it back :S</div><div><br></div><div>The script goes a bit further now and gives me this error (dont know if the syntax is right or anything like that, or need to configure anything?)</div>
<div><br></div><div><div>dave@dave-virtual-machine:~/uksub2srt$ ~dave/uksub2srt/rename.py 1010 20120202234800</div><div>Traceback (most recent call last):</div><div>  File &quot;/home/dave/uksub2srt/rename.py&quot;, line 13, in &lt;module&gt;</div>
<div>    oldbase = prog.basename.rsplit(&#39;.&#39;,1)[0]</div><div>  File &quot;/usr/lib/pymodules/python2.7/MythTV/altdict.py&quot;, line 27, in __getattr__</div><div>    raise AttributeError(str(name))</div><div>AttributeError: basename</div>
</div><div><br></div>