1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 00:21:15 +03:00

Add support for use when frozen

Use appropriate path to find resource when frozen (using py2exe etc.)
This commit is contained in:
Andrew Leech 2015-09-25 11:30:56 +10:00
parent 96f1fafcca
commit f44ae6d85f

View File

@ -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)