From e8b28d6f87af150b0d44f976d450ad04c2aa3cc3 Mon Sep 17 00:00:00 2001 From: deeplow Date: Thu, 3 Aug 2023 20:34:42 +0100 Subject: [PATCH] Explicitly import html.parser for Cx_Freeze to build The markdown dependency uses importlib to monkeypatch 'html.parser' [1]. Due to this approach 'html.parser' is never explicitly stated as a dependency. This works fine in most cases, since it's part of the python standard lib. But on Windows the build tool (CxFreeze) ships in the .exe only the modules needed. And because html.parser is never mentioned, it fails with an error (see issue #501). Fixes #501 [1]: https://github.com/Python-Markdown/markdown/blob/master/markdown/htmlparser.py#L29 --- dangerzone/gui/updater.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dangerzone/gui/updater.py b/dangerzone/gui/updater.py index e8ca367..9190b8d 100644 --- a/dangerzone/gui/updater.py +++ b/dangerzone/gui/updater.py @@ -18,6 +18,10 @@ else: except ImportError: from PySide2 import QtCore, QtWidgets +# XXX implict import for "markdown" module required for Cx_Freeze to build on Windows +# See https://github.com/freedomofpress/dangerzone/issues/501 +import html.parser + import markdown import requests