pdm run
does not parse the requested python version correctly
#1414
Labels
🐛 bug
Something isn't working
pdm run
does not parse the requested python version correctly
#1414
Make sure you run commands with
-v
flag before pasting the output.Steps to reproduce
$ mkdir -p project $ cd project $ pdm init
Actual behavior
No matter what version I request with
pdm run python3.X
,pdm
always pick the selectedpython3.7
as the interpreter.Expected behavior
If
python3.X
is not configured for the current project, I would expectpdm run python3.X
to fall back to search in the systemPATH
variable. Thus if I dopdm run python3.10
, it should give mepython3.10
in the systemPATH
, and if I dopdm run python3.20
, it should produce an error message like the following:This way, the handling of python interpreter would be consistent with the handling of other executables by
pdm run
.Possible causes
I believe the cause if the usage of
splitext
in parsing the command sent topdm run
inpdm/models/environment.py
:The first line discards the version string after the first dot, so python3.20 would be parsed as python3 going forward. I think this is a bug.
Environment Information
The text was updated successfully, but these errors were encountered: