Skip to content
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

Better error message if a command is not in environment #35

Open
EthanMarx opened this issue Jan 26, 2023 · 1 comment
Open

Better error message if a command is not in environment #35

EthanMarx opened this issue Jan 26, 2023 · 1 comment

Comments

@EthanMarx
Copy link

if pinto run is called with a command that is not available in the corresponding environment, it will throw a FileNotFoundError, which can be misleading.

My guess is that pinto is trying to access the command, doesn't find it, and then assumes the user is trying to run a pipeline, looks for a pyproject.toml, and likely also doesn't find that. Maybe loggingf"command {command} not found in environment {env}"after the check for the command would be more clear.

@EthanMarx EthanMarx changed the title Better exception if a command is not in environemnt Better error message if a command is not in environment Jan 26, 2023
@alecgunny
Copy link
Contributor

So it's not actually a pinto thing, pinto leaves it to the underlying subprocess call to try to run the executable you give it and then raise whatever error it wants when/if it fails. For poetry projects, this is done with subprocess.Popen, and I agree that their choice of FileNotFoundError for a missing executable is less than helpful.

For conda projects, I think they call subprocess.run but I'd have to double check. The error isn't super clean, but you at least get a command not found at the end. Conda is tricky because they wrap each conda run call in a complicated shell script which manages the setup and cleanup of the conda environment.

So agree standardizing this across the two projects would be helpful, would just be a matter of how best to search each environment for the existence of the executable in a standardized way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants