From f44ae6d85f1da675ab4f88de7f9979d8bfd629c7 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Fri, 25 Sep 2015 11:30:56 +1000 Subject: [PATCH] Add support for use when frozen Use appropriate path to find resource when frozen (using py2exe etc.) --- weasyprint/html.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/weasyprint/html.py b/weasyprint/html.py index 2d67fccf..0913848e 100644 --- a/weasyprint/html.py +++ b/weasyprint/html.py @@ -19,6 +19,7 @@ from __future__ import division, unicode_literals import os.path import logging +import sys import re from .css import get_child_text @@ -33,8 +34,8 @@ from . import CSS level = LOGGER.level LOGGER.setLevel(logging.ERROR) -HTML5_UA_STYLESHEET = CSS( - filename=os.path.join(os.path.dirname(__file__), 'css', 'html5_ua.css')) +root = os.path.dirname(sys.executable) if hasattr(sys, "frozen") else os.path.dirname(__file__) +HTML5_UA_STYLESHEET = CSS(filename= os.path.join(root, 'css', 'html5_ua.css')) LOGGER.setLevel(level)