# HG changeset patch # User Edouard Tisserant <edouard@beremiz.fr> # Date 1736438940 -3600 # Node ID 6a8fd46e998093b1dc8521c300639c515cab106d # Parent 3ef4b5b202fc822546b2de4ac642b31612145b3f SVGHMI: fix build exception when static file directory is missing diff -r 3ef4b5b202fc -r 6a8fd46e9980 svghmi/svghmi.py --- a/svghmi/svghmi.py Fri Dec 20 14:37:10 2024 +0100 +++ b/svghmi/svghmi.py Thu Jan 09 17:09:00 2025 +0100 @@ -574,10 +574,11 @@ project_path = self.CTNPath() static_dir = os.path.join(project_path, "static") static_files_pairs = [] - for fname in os.listdir(static_dir): - undercover_fname = location_str+"_"+fname - static_files_pairs.append('(b"%s","%s")'%(fname, undercover_fname)) - res += ((undercover_fname, open(os.path.join(static_dir, fname), "rb")),) + if os.path.exists(static_dir): + for fname in os.listdir(static_dir): + undercover_fname = location_str+"_"+fname + static_files_pairs.append('("%s","%s")'%(fname, undercover_fname)) + res += ((undercover_fname, open(os.path.join(static_dir, fname), "rb")),) static_files = ",\n ".join(static_files_pairs) if os.path.exists(svgfile):