<br><br><div class="gmail_quote">On 4 February 2012 16:21, David Crawford <span dir="ltr"><<a href="mailto:davidcrawford83@gmail.com">davidcrawford83@gmail.com</a>></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"><<a href="mailto:jeremy.dwain.jones@gmail.com" target="_blank">jeremy.dwain.jones@gmail.com</a>></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><<a href="mailto:davidcrawford83@gmail.com" target="_blank">davidcrawford83@gmail.com</a>> wrote:<br>
><br>
><br>
> On 3 February 2012 22:19, David Crawford <<a href="mailto:davidcrawford83@gmail.com" target="_blank">davidcrawford83@gmail.com</a>> wrote:<br>
>><br>
>><br>
>><br>
>> On 3 February 2012 22:17, Raymond Wagner <<a href="mailto:raymond@wagnerrp.com" target="_blank">raymond@wagnerrp.com</a>> wrote:<br>
>>><br>
>>> On 2/3/2012 17:12, David Crawford wrote:<br>
>>> > bash: syntax error near unexpected token '1010'<br>
>>><br>
<br>
</div>Did you have the < 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>
>>> If you are getting anything "bash", it means that your "hashbang" is not<br>
>>> configured properly, and your system is instead trying to run the script<br>
>>> directly in whatever shell you are currently running (which seems to be<br>
>>> 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 <1010><br>
<div>bash: syntax error near unexpected token `1010'<br>
<br>
</div>Just to further drive home the point of the <brackets>:<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 "<" or the ending ">".<br>
<div><br>
<br>
>>> <a href="http://en.wikipedia.org/wiki/Shebang_%28Unix%29#Examples" target="_blank">http://en.wikipedia.org/wiki/Shebang_%28Unix%29#Examples</a><br>
>>><br>
>>> In the case of the jobqueue, it currently passes everything through the<br>
>>> Bourne shell (/bin/sh), but the end result would be the same.<br>
>>> _______________________________________________<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>
>><br>
>><br>
>> Wouldnt that prevent the other script from not working also?<br>
><br>
> When running with " " for "<Chanid>"and "<starttime>"<br>
><br>
> I instead get<br>
><br>
> chanid, starttime = sys.arg[1:3]<br>
> ValueError: need more than 1 value to unpack<br>
><br>
><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 "<" also and without ".py". 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 "/home/dave/uksub2srt/rename.py", line 7, in <module></div><div class="im"><div> raise Exception('Invalid argument count') </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('Invalid argument count') </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('.',1)[0]</div>
</div><div>newbase = prog.formatPath('%m-%d_%H-%i-%cN_%T').rsplit('.',1)[0]</div><div class="im"><div>sg = findfile(prog.basename, prog.storagegroup)</div><div>if sg is None:</div><div> raise Exception('file not found')</div>
<div><br></div><div>from MythTV import System</div><div>ccextractor = System(path="/home/dave/uksub2srt/uksub2srt.py")</div><div>ccextractor('-i', os.path.join(sg.dirname, prog.basename),</div></div><div>
'-o', '/home/dave/Downloads/subtitles/{0}.srt'.format(newbase))</div>
</div></div></div><div><br></div>
</blockquote></div><br><div>Ok - so that error was down to having "if len(sys.argv) != 2:" 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 "/home/dave/uksub2srt/rename.py", line 13, in <module></div>
<div> oldbase = prog.basename.rsplit('.',1)[0]</div><div> File "/usr/lib/pymodules/python2.7/MythTV/altdict.py", line 27, in __getattr__</div><div> raise AttributeError(str(name))</div><div>AttributeError: basename</div>
</div><div><br></div>