liminspace / django-mjml

The simplest way to use MJML in Django templates.
MIT License
260 stars 32 forks source link

django.core.exceptions.ImproperlyConfigured: Problem to run command "mjml -i -s" #183

Closed cznsb closed 11 months ago

cznsb commented 11 months ago

l have mjml installed propely, but when l add it in my installed app in django it returns the following error below. and if I re-run pip install django-mjml it returns requirements already satisfied. where do l went wrong?

`

(venv) c:\N2G-PROJECT\my_site>py manage.py runserver Watching for file changes with StatReloader Exception in thread django-main-thread: Traceback (most recent call last): File "C:\N2G-PROJECT\venv\Lib\site-packages\mjml\tools.py", line 30, in _mjml_render_by_cmd p = subprocess.Popen(cmd_args, stdin=subprocess.PIPE, stdout=stdout_tmp_f, stderr=subprocess.PIPE) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sb\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1026, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\sb\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1538, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] The system cannot find the file specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\N2G-PROJECT\venv\Lib\site-packages\mjml\apps.py", line 10, in check_mjml_command html = mjml_render( ^^^^^^^^^^^^ File "C:\N2G-PROJECT\venv\Lib\site-packages\mjml\tools.py", line 158, in mjml_render return _mjml_render_by_cmd(mjml_source) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\N2G-PROJECT\venv\Lib\site-packages\mjml\tools.py", line 34, in _mjml_render_by_cmd raise RuntimeError( RuntimeError: Problem to run command "mjml -i -s" [WinError 2] The system cannot find the file specified Check that mjml is installed and allow permissions to execute. See https://github.com/mjmlio/mjml#installation

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\N2G-PROJECT\venv\Lib\site-packages\mjml\tools.py", line 30, in _mjml_render_by_cmd p = subprocess.Popen(cmd_args, stdin=subprocess.PIPE, stdout=stdout_tmp_f, stderr=subprocess.PIPE) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sb\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1026, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\sb\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1538, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] The system cannot find the file specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\N2G-PROJECT\venv\Lib\site-packages\mjml\apps.py", line 17, in check_mjml_command html = mjml_render( ^^^^^^^^^^^^ File "C:\N2G-PROJECT\venv\Lib\site-packages\mjml\tools.py", line 158, in mjml_render return _mjml_render_by_cmd(mjml_source) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\N2G-PROJECT\venv\Lib\site-packages\mjml\tools.py", line 34, in _mjml_render_by_cmd raise RuntimeError( RuntimeError: Problem to run command "mjml -i -s" [WinError 2] The system cannot find the file specified Check that mjml is installed and allow permissions to execute. See https://github.com/mjmlio/mjml#installation

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\sb\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner self.run() File "C:\Users\sb\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run self._target(*self._args, self._kwargs) File "C:\N2G-PROJECT\venv\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper fn(*args, *kwargs) File "C:\N2G-PROJECT\venv\Lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run autoreload.raise_last_exception() File "C:\N2G-PROJECT\venv\Lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception raise _exception[1] File "C:\N2G-PROJECT\venv\Lib\site-packages\django\core\management__init__.py", line 394, in execute autoreload.check_errors(django.setup)() File "C:\N2G-PROJECT\venv\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper fn(args, kwargs) File "C:\N2G-PROJECT\venv\Lib\site-packages\django__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "C:\N2G-PROJECT\venv\Lib\site-packages\django\apps\registry.py", line 124, in populate app_config.ready() File "C:\N2G-PROJECT\venv\Lib\site-packages\mjml\apps.py", line 37, in ready check_mjml_command() File "C:\N2G-PROJECT\venv\Lib\site-packages\mjml\apps.py", line 23, in check_mjml_command raise ImproperlyConfigured(e) from e django.core.exceptions.ImproperlyConfigured: Problem to run command "mjml -i -s" [WinError 2] The system cannot find the file specified Check that mjml is installed and allow permissions to execute. See https://github.com/mjmlio/mjml#installation

`

liminspace commented 11 months ago

@cznsb installing mjml properly means in cmd mode mjmjl cli is working. BTW try to use MacOS or Linux, Windows is not your choice in that stack. If you love Windows, you should use Docker to run Python and mjml/node. I'll close that issue as it's not related to django-mjmjl.