grei-ufc / pade

Python Agent DEvelopment framework
MIT License
96 stars 40 forks source link

Error with start-web-interface #67

Open ShrutiKaha opened 3 years ago

ShrutiKaha commented 3 years ago

(base) C:\Users\shrut>pade start-web-interface [...] Creating Pade tables in selected data base. [ok_] Tables created in selected data base [...] Starting Flask web interface. Traceback (most recent call last): File "c:\programdata\anaconda3\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\programdata\anaconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\ProgramData\Anaconda3\Scripts\pade.exe__main.py", line 7, in File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 829, in call__ return self.main(args, kwargs) File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 782, in main rv = self.invoke(ctx) File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 610, in invoke return callback(args, **kwargs) File "c:\programdata\anaconda3\lib\site-packages\pade\cli\pade_cmd.py", line 289, in start_web_interface p = FlaskServerProcess() TypeError: init() missing 1 required positional argument: 'secure'

singalhimanshu commented 3 years ago

I don't think this api is complete yet. One way to make it work is by passing --secure flag but for that the following changes has to be made -

@cmd.command()
@click.option('--secure', is_flag=True)
def start_web_interface(secure):
    create_tables()
    click.echo(click.style('[...] Starting Flask web interface.', fg='red'))

    p = FlaskServerProcess(secure)
    p.daemon = True
    p.start()

    while True:
        time.sleep(2.0)

        if interrupted:
            click.echo(click.style('\nStoping PADE...', fg='red'))
            p.kill()
            break

    click.echo(click.style('[ok_] Flask web interface stopped', fg='green'))

I am not completely sure if this is the intented solution. Please let me know I can create a pull request to fix this issue.