Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weazyprint 0.37 fails with google font stylesheets #477

johndagostino opened this issue Jun 16, 2017 · 1 comment

weazyprint 0.37 fails with google font stylesheets #477

johndagostino opened this issue Jun 16, 2017 · 1 comment


Copy link

@johndagostino johndagostino commented Jun 16, 2017

Example below works as expected on 0.36 but fails with the recently released 0.37

Backtrace from WeazyPrint

Traceback (most recent call last):
  File "/usr/local/bin/weasyprint", line 11, in <module>
    load_entry_point('WeasyPrint==0.37', 'console_scripts', 'weasyprint')()
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/", line 172, in main
    getattr(html, 'write_' + format_)(output, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/", line 181, in write_pdf
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/", line 146, in render
    self, stylesheets, enable_hinting, presentational_hints)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/", line 317, in _render
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/", line 770, in get_all_computed_styles
    element_tree, device_media_type, url_fetcher, font_config))
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/", line 160, in find_stylesheets
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/", line 268, in __init__
    self.fonts, font_config)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/", line 722, in preprocess_stylesheet
    base_url, content))
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/", line 165, in preprocess_descriptors
    result = list(validate(base_url,, tokens))
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/", line 143, in validate
    value = function(tokens, base_url)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/", line 172, in wrapper
    result = function(remove_whitespace(part), *args)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/", line 76, in src
    return 'local', font_family(token.content, allow_spaces=True)
AttributeError: 'FunctionBlock' object has no attribute 'content'

Example test html file

<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <link href=",400,700" rel="stylesheet">
  <div class="book">
@liZe liZe closed this in ccf58d7 Jun 16, 2017
Copy link

@liZe liZe commented Jun 16, 2017

Thanks for reporting this issue, sorry for this problem…

@liZe liZe added bug crash labels Jun 16, 2017
@liZe liZe added this to the v0.38 milestone Jun 16, 2017
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Aug 1, 2017
Version 0.39

Released on 2017-06-24.

Bug fixes:

* Fix the use of WeasyPrint's URL fetcher with CairoSVG.

Version 0.38

Released on 2017-06-16.

Bug fixes:

* `#477 <>`_:
  Don't crash on font-face's src attributes with local functions.

Version 0.37

Released on 2017-06-15.

WeasyPrint now depends on tinycss2 instead of tinycss.

New features:

* `#437 <>`_:
  Support local links in generated PDFs.

Bug fixes:

* `#412 <>`_:
  Use a NullHandler log handler when WeasyPrint is used as a library.
* `#417 <>`_,
  `#472 <>`_:
  Don't crash on some line breaks.
* `#327 <>`_:
  Don't crash with replaced elements with height set in percentages.
* `#467 <>`_:
  Remove incorrect line breaks.
* `#446 <>`_:
  Let the logging module do the string interpolation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.