-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trogon script execution fails with FileNotFoundError: [Errno 2] No such file or directory #70
Comments
I can confirm the bug. Also, if you don't select anything the demo fails with a different error, but the selection is not marked as compulsory. This is probably less of an issue but still got me confused initially. Anyway the No such file or directory also occurs for me in my attempts to use this project in another practical app. |
@mgielda by any chance are you running trogon inside a virtual environment? I noticed that trogon echos a preview of the command it will run when ctrl-R is pressed. If that preview command were entered directly on the command line, would the environment be set correctly so the script would be in the path? In my case, the answer was no. I solved this in my situation by activating the virtual environment in my shell before launching trogon. Previously, I had been launching in a different way that avoided the shell activation part of venv. |
I have the same issue.
I am not in a virtual environment and using the default python.
scripts main *% = $ python .\trogon_demo.py tui
Running trogon_demo.py add test
Traceback (most recent call last):
File "C:\_projects\onboarding_template\scripts\trogon_demo.py", line 89, in <module>
cli(obj={})
File "C:\python\v311\Lib\site-packages\click\core.py", line 1130, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\v311\Lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\python\v311\Lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\v311\Lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\v311\Lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\v311\Lib\site-packages\click\decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\v311\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:\python\v311\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 |
I confirm that extending trogon.py in the run function like the following solve my issue arguments = [f"./{program_name}", *self.post_run_command]
print(f"{program_name=}, {arguments=}")
os.execvp("python", arguments) meaning:
It strangely does not work on the demo.py from the examples folder.
|
these changes solves the issue for me: arguments = [*split_app_name, *self.post_run_command]
program_name = os.path.abspath(program_name)
arguments = [sys.executable, f"{program_name}", *self.post_run_command]
os.execvp(sys.executable, arguments) |
Running the nogroup_demo example fails with FileNotFoundError: [Errno 2] No such file or directory
The cwd and the program_name arguments to the os.execvp call seem to be correct, however the run still fails. The cli version works fine though.
I added a debug log just before the call to execvp listing the following
prog_name = nogroup_demo.py, args = ['nogroup_demo.py', 'add', '--category', 'work', 'foo'] app_name = nogroup_demo.py cwd = /Users/arunabhaghosh/dev/import_migrate_data
---- Details--------------------------
The text was updated successfully, but these errors were encountered: