You should really not do it this way. The reload function is not a
controller and therefore does not belong there. If should go in a module.
You should import it from there and call it from where you need it.
On Wednesday, 4 April 2012 11:39:53 UTC-5, Ramos wrote:
>
> I have a PBX in linux that can call scripts in python
> I´m trying to call a script in my web2py app and pass some vars.
>
> i have a script in python that in the end calls another script
>
> os.system("python /../../web2py.py -S app/default/reload/ -M -A arg1")
>
>
> Thank you
> António
>
>
>
>
> 2012/4/4 Anthony <[email protected]>
>
>> On Wednesday, April 4, 2012 12:16:46 PM UTC-4, Ramos wrote:
>>>
>>> i changed to another function "reload", so i can open my index in the
>>> browser
>>>
>>> executing python web2py.py -S myapp/default/reload -M -A aaaa
>>>
>>> i get the error
>>> reload() takes exactly 1 argument (0 given)
>>>
>>
>> What exactly are you trying to do? I think the -A option only works if
>> you are running a script file via the -R option -- it doesn't pass
>> arguments to a controller function run with the -S option.
>>
>> python web2py.py -S myapp/default/reload -M
>>
>> is intended to execute the reload function in a Python shell. If you want
>> to start and stay in a Python shell in the environment of your controller,
>> you can do:
>>
>> python web2py.py -S myapp/default -M
>>
>> and then at the Python shell command line you could do:
>>
>> >>> reload(arg1='myarg')
>>
>> or if reload() is an action (i.e., it doesn't take any arguments):
>>
>> >>> request.args.append('myarg')
>> >>> reload()
>>
>> and then the reload() function can access 'myarg' via request.args(0).
>>
>> Anthony
>>
>
>