The problem seems to be that when we issue a command like this (which the newcron does):
python web2py.py ... -J ...
...the -J is interpreted as an argument to python rather than to web2py.py.
I believe this can be fixed by adding a line in newcron.py. Change:
w2p_path = fileutils.abspath('web2py.py', gluon=True)
if os.path.exists(w2p_path):
commands.append(w2p_path)
to
w2p_path = fileutils.abspath('web2py.py', gluon=True)
if os.path.exists(w2p_path):
commands.append(w2p_path)
commands.append('--')
(BTW, the os.path.exists logic seems broken. If the path doesn't exist, it doesn't make sense to continue at all.)
> what does append('--') do?
It tells the command (python in this case) to stop processing command-line options for itself.
man bash:
-- A -- signals the end of options and disables further option processing. Any arguments
after the -- are treated as filenames and arguments. An argument of - is equivalent to --.
> ok adding --.
>
> The reason it does not fail when it does not find web2py.py is that
> (if I remember) this should work which binary distributions which do
> not have a web2py.py.
I see. In that case, appending -- should be part of the if body (that is, indent it one level from my patch below).
> On Jan 30, 2012, at 9:27 AM, Massimo Di Pierro wrote:
>
>> ok adding --.
>>
>> The reason it does not fail when it does not find web2py.py is that
>> (if I remember) this should work which binary distributions which do
>> not have a web2py.py.
>
> I see. In that case, appending -- should be part of the if body (that is, indent it one level from my patch below).
This might be a little more complicated. I believe that we want the -- if the command we're running is python, but not if the command we're running is web2py.py or the equivalent.