The prepare_code function was calling which on the specified command before it checked whether the associated code already existed. This means that it would raise if which fails to detect the absolute path, even if the user pre-created a Code instance for the command manually in advance to circumvent this problem.
The check is now moved to the except block in case the code doesn't exist. It is only then that a code needs to be created and so only then that it makes sense to perform the check on the provided command.
The
prepare_code
function was callingwhich
on the specified command before it checked whether the associated code already existed. This means that it would raise ifwhich
fails to detect the absolute path, even if the user pre-created aCode
instance for the command manually in advance to circumvent this problem.The check is now moved to the
except
block in case the code doesn't exist. It is only then that a code needs to be created and so only then that it makes sense to perform the check on the provided command.