diff --git a/zerver/lib/email_notifications.py b/zerver/lib/email_notifications.py index b62fa1faa2..44a023b8b6 100644 --- a/zerver/lib/email_notifications.py +++ b/zerver/lib/email_notifications.py @@ -2,8 +2,10 @@ import logging import math +import os import re import subprocess +import sys from collections import defaultdict from datetime import timedelta from email.headerregistry import Address @@ -740,7 +742,9 @@ def enqueue_welcome_emails(user: UserProfile, realm_creation: bool = False) -> N def convert_html_to_markdown(html: str) -> str: # html2text is GPL licensed, so run it as a subprocess. - markdown = subprocess.check_output(["html2text"], input=html, text=True).strip() + markdown = subprocess.check_output( + [os.path.join(sys.prefix, "bin", "html2text")], input=html, text=True + ).strip() # We want images to get linked and inline previewed, but html2text will turn # them into links of the form `![](http://foo.com/image.png)`, which is