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.
|
I confirm that extending trogon.py in the run function like the following solve my issue
meaning:
It strangely does not work on the demo.py from the examples folder.
|
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--------------------------
Running nogroup_demo.py add --category work foo
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
Traceback (most recent call last):
File "/Users/arunabhaghosh/dev/import_migrate_data/nogroup_demo.py", line 52, in
add()
File "/Users/arunabhaghosh/dev/import_migrate_data/venv/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunabhaghosh/dev/import_migrate_data/venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/Users/arunabhaghosh/dev/import_migrate_data/venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunabhaghosh/dev/import_migrate_data/venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunabhaghosh/dev/import_migrate_data/venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunabhaghosh/dev/import_migrate_data/venv/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunabhaghosh/dev/import_migrate_data/venv/lib/python3.11/site-packages/trogon/trogon.py", line 297, in wrapped_tui
Trogon(app, app_name=name, command_name=command, click_context=ctx).run()
File "/Users/arunabhaghosh/dev/import_migrate_data/venv/lib/python3.11/site-packages/trogon/trogon.py", line 265, in run
os.execvp(program_name, arguments)
File "", line 574, in execvp
File "", line 616, in _execvpe
File "", line 607, in _execvpe
FileNotFoundError: [Errno 2] No such file or directory
The text was updated successfully, but these errors were encountered: