Skip to content

Commit 0dbde29

Browse files
committed
Handles missing pip
1 parent ae415e3 commit 0dbde29

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/tailwind/management/commands/tailwind.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,15 @@ def handle_init_command(self, **options):
7777
from cookiecutter.main import cookiecutter
7878
except ImportError:
7979
self.stdout.write("Cookiecutter is not found, installing...")
80-
install_pip_package("cookiecutter")
81-
from cookiecutter.main import cookiecutter
80+
try:
81+
raise ModuleNotFoundError
82+
install_pip_package("cookiecutter")
83+
from cookiecutter.main import cookiecutter
84+
except ModuleNotFoundError:
85+
raise CommandError(
86+
"Failed to install 'cookiecutter' via pip. Please install it manually "
87+
"(https://pypi.org/project/cookiecutter/) and run 'python manage.py tailwind init' again."
88+
)
8289

8390
try:
8491
app_path = cookiecutter(

0 commit comments

Comments
 (0)