Skip to content

trogon with standalone_mode of click is not working #65

@thisismygitrepo

Description

@thisismygitrepo
import click
from trogon import tui
from typing import Any


@tui()
@click.command()
@click.option('--description', prompt="Description of the job: ", default=f"Description of running func on remotes", help="Write something that describes what this job is about.")
@click.option('--update_repo', prompt="Update repo: ", default=False, help="Update the repo on the remote machine.")
@click.pass_context
def get_choices(ctx: Any, description: str, update_repo: bool):
    return ctx


if __name__ == '__main__':
    res = get_choices(standalone_mode=False)
    print(res)

This is producing this error:

$ python C:\Users\aalsaf01\code\crocodile\myresources\crocodile\cluster\template_tui2.py tui
Running template_tui2.py get-choices
Traceback (most recent call last):
  File "C:\Users\aalsaf01\code\crocodile\myresources\crocodile\cluster\template_tui2.py", line 20, in <module>
    res = get_choices(standalone_mode=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\aalsaf01\venvs\ve\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\aalsaf01\venvs\ve\Lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\aalsaf01\venvs\ve\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\aalsaf01\venvs\ve\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\aalsaf01\venvs\ve\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\aalsaf01\venvs\ve\Lib\site-packages\click\decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\aalsaf01\venvs\ve\Lib\site-packages\trogon\trogon.py", line 296, in wrapped_tui
    Trogon(app, app_name=name, command_name=command, click_context=ctx).run()
  File "C:\Users\aalsaf01\venvs\ve\Lib\site-packages\trogon\trogon.py", line 264, in run
    os.execvp(program_name, arguments)
  File "<frozen os>", line 574, in execvp
  File "<frozen os>", line 616, in _execvpe
  File "<frozen os>", line 607, in _execvpe
FileNotFoundError: [Errno 2] No such file or directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions