I am having issue with using inlinecss for html, I am using
from pynliner import fromString as inlinecss
email = mail.EmailMultiAlternatives(
subject=my_subject,
to=to,
# set return path for undeliverable emails
from_email=settings.DEFAULT_MAIL_RETURN_PATH,
body=(plaintext),
**kws
)
email.attach_alternative(
inlinecss(html_string),
‘text/html’
)
I modified it to use
Please show the full traceback so we can advise where the bug is coming from.
Also see About the Python Help category for how to use preformatted text.
tail -f celery_beat_stderr.log
not nested and not items))
File "/usr/lib64/python3.6/sre_parse.py", line 765, in _parse
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "/usr/lib64/python3.6/sre_parse.py", line 416, in _parse_sub
not nested and not items))
File "/usr/lib64/python3.6/sre_parse.py", line 543, in _parse
code2 = _class_escape(source, that)
File "/usr/lib64/python3.6/sre_parse.py", line 330, in _class_escape
'range 0-0o377' % escape, len(escape))
sre_constants.error: octal escape value \777 outside of range 0-0o377 at position 252
That is clearly not full; a full traceback will start with a line that says Traceback (most recent call last):.
The other useful thing you can do is to try to check the data that you have. For example, the error message says something about octal escape value \777. Do you see anything like that \777 in your data, particularly in the html_string?
(Another possibility is that the version you have installed for the library, is not compatible with your version of Python. If the “pynliner” that you are using is GitHub - rennat/pynliner: Python CSS-to-inline-styles conversion tool for HTML using BeautifulSoup and cssutils, then it is very out of date, and should not be expected to work with an up-to-date Python. It has not been updated since just-barely-2017, and does not claim to support Python past 3.5.)