poetry run script doesn't run the actual executable script #2435
Labels
area/cli
Related to the command line
kind/bug
Something isn't working as expected
status/duplicate
Duplicate issues
-vvv
option).Issue
I'm trying to run django management command not through
python manage.py command
as usual, so that I can have single entry-point to my django app. I prefer to write my cli using Click instead of django management command framework which having to many boilerplate. This basically works perfectly fine. Example of the script is https://github.com/k4ml/cutepony/blob/master/cutepony/cli/cutepony.py. I can run any command with the following:-The problem is with runserver command when running with autoreload (the default). The way autoreload is implemented is that it will re-execute the command using subprocess and to do that, it will re-collect the original command, using sys.executable and sys.argv. But using
poetry run
above, the resulting command that django will see is like:-and will fail with the following error:-
This is because it try to run
cutepony
as python module. The correct command that django should see is:-The fix for this seem quite simple, in
poetry/console/commands/run.py:RunCommand.run_script()
, we can fix args[0] to be an absolute path to the script executable.The text was updated successfully, but these errors were encountered: