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

Got u'o, ' between two lines. Expected nothing or a preserved line break #472

Closed
PauloTeixeiraJunior opened this issue May 26, 2017 · 22 comments
Assignees
Labels
bug Existing features not working as expected crash Problems preventing documents from being rendered
Milestone

Comments

@PauloTeixeiraJunior
Copy link

PauloTeixeiraJunior commented May 26, 2017

I use versions weasyprint 0.34 and Cairo 1.0.22
I am have this problem a long time, but so far don't find a solution for this.

Please my friends, help.

 File "/home/paulo/sgp_desenv/src/sgp_dms/creator.py", line 94, in create_pdf_document
    main_document = html_converter.render()
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/__init__.py", line 143, in render
    self, stylesheets, enable_hinting, presentational_hints)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/document.py", line 334, in _render
    [Page(p, enable_hinting) for p in page_boxes],
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/__init__.py", line 53, in layout_document
    pages = list(make_all_pages(context, root_box))
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/pages.py", line 567, in make_all_pages
    page_number)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/pages.py", line 513, in make_page
    positioned_boxes, positioned_boxes, adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 69, in block_level_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 97, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 599, in block_container_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 69, in block_level_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 97, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 599, in block_container_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 69, in block_level_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 97, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 599, in block_container_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 69, in block_level_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 97, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 599, in block_container_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 69, in block_level_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 97, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 599, in block_container_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 69, in block_level_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 97, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 599, in block_container_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 69, in block_level_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 97, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 599, in block_container_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 69, in block_level_layout
    adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 97, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 478, in block_container_layout
    for line, resume_at in lines_iterator:
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/inlines.py", line 48, in iter_line_boxes
    device_size, absolute_boxes, fixed_boxes)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/inlines.py", line 100, in get_next_linebox
    line_fixed, line_placeholders, waiting_floats)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/inlines.py", line 594, in split_inline_box
    waiting_floats)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/inlines.py", line 491, in split_inline_level
    context, box, max_x - position_x, max_x, skip)
  File "/home/paulo/.virtualenvs/sgp/local/lib/python2.7/site-packages/weasyprint/layout/inlines.py", line 718, in split_text_box
    'Expected nothing or a preserved line break' % (between,))
AssertionError: Got u'o, ' between two lines. Expected nothing or a preserved line break
@liZe
Copy link
Member

liZe commented May 27, 2017

Please my friends, help.

Please my friend, help! Give us the HTML document!

@liZe liZe added bug Existing features not working as expected crash Problems preventing documents from being rendered labels May 27, 2017
@liZe
Copy link
Member

liZe commented May 27, 2017

Probably related to #417.

@PauloTeixeiraJunior
Copy link
Author

code_html.txt
Code html used to conversion of html to pdf.

@liZe
Copy link
Member

liZe commented May 30, 2017

I can't reproduce the problem. Could you please help me?

  • Which font do you use (you can find it in the PDF metadata)?
  • Which versions of Cairo and Pango do you have (I think that you have CairoSVG 1.0.22, not Cairo 1.0.22)?

@PauloTeixeiraJunior
Copy link
Author

I am using libpango1.0-0 and CairoSVG 1.0.22.
I am using too cairocffi==0.7.1.

So, the font used inside html to conversion from pdf is "Trebuchet MS", Arial, Helvetica, sans-serif;

Thank you for your attention.

@PauloTeixeiraJunior
Copy link
Author

I roolback a version of the weasyprint to 0.23, and the error ocurred doesn't work.
Probably is a version next to 0.23.

@liZe
Copy link
Member

liZe commented May 30, 2017

@PauloTeixeiraJunior Sorry, but that's not exactly what I wanted 😢. I'd like to have:

  • the exact version of pango (the result of pango-view --version in a console),
  • the version of cairo, not cairosvg (the result of cairo-trace --version in a console),
  • the font embedded in the PDF, not the font-family rule in the HTML (in Evince for example, you can have it by clicking on "Properties" in the burger menu, "Fonts" tab).

@PauloTeixeiraJunior
Copy link
Author

Sorry @liZe . Now take the version correctly.

  • pango-view (pango) 1.36.3
  • The cairo-trace --version returns that doesn't installed. I have only cairoSVG and cairocffi

But, i have tried some versions of weasyprint, and i find out that after version 0.30 this error happens.
In version 0.30 this error does happens.

@PauloTeixeiraJunior
Copy link
Author

Do you forgot me? ;(

@liZe
Copy link
Member

liZe commented May 31, 2017

Do you forgot me? ;(

No, I just don't spend my time fixing WeasyPrint's bugs.

  1. I really need the font included in your PDF. If you're too lazy to find the font, change the text in your HTML file to avoid the bug and attach the generated PDF in the issue comments.
  2. I'd like to have the version of Cairo you're using. It's installed by your Linux distribution, find the version of the "cairo" or "libcairo" package (the name depends on the distribution).

If I can't reproduce the bug, I can't help you. To reproduce the bug, I need these informations.

@PauloTeixeiraJunior
Copy link
Author

Sorry @liZe , I realy don't know find out this informations.
I can the informations necessaries:

  1. Fonts used in PDF generated:
    - NimbusSanL-Regu and NimbusSanL-Bold
    Type 1 / Codification: WinAnsi / Embedded subassembly

  2. My version of the Cairo is 1.13.1

Again, sorry, sorry.
Maybe with this informations you can reproduce the error.

Thank you for all.

@PauloTeixeiraJunior
Copy link
Author

@liZe Were you able to reproduce the error?

@liZe
Copy link
Member

liZe commented Jun 1, 2017

Please stop that. Asking me to help you again and again is not a solution, it just gives me a really good reason to ignore you.

My version of the Cairo is 1.13.1

Really? According to this version number, you're using a development version of an unstable branch of Cairo. It's not even tagged on the Cairo repository.

Please attach a PDF, I'll find the information myself.

Were you able to reproduce the error?

And no, I can't reproduce. Here is what I get:

test.pdf

There's no comma in your HTML sample, but there's one in your error message. You didn't provide the HTML sample you have a problem with.

Please try to be serious and give me good information, or I'll just close this issue (by the way, it's probably a duplicate of #417).

@gsvimieiro
Copy link

Hi liZe

I have the same problem as our friend Paulo, and found that in version 0.30 there is no such problem, but I can not use this version because I use document printing in two columns and version 0.34 solved this question.

Attachment my html
my_html.txt

liZe added a commit that referenced this issue Jun 3, 2017
@liZe
Copy link
Member

liZe commented Jun 3, 2017

@gsvimieiro Thanks for this example, it's been fixed in 8109499 (first time I've seen three soft hyphens at the beginning of a line 😉).

@PauloTeixeiraJunior Now that #417 and @gsvimieiro's bug are fixed, could you tell me if your problem is solved?

@liZe liZe self-assigned this Jun 3, 2017
@liZe liZe added this to the v0.37 milestone Jun 3, 2017
@gsvimieiro
Copy link

Dear liZe

I did not found version v0.37 . Do you have launch this release?

@liZe
Copy link
Member

liZe commented Jun 5, 2017

I did not found version v0.37 . Do you have launch this release?

No, I'd like you to test the current git version, I'll close this issue and release a new version if it works.

@gsvimieiro
Copy link

Dear liZe

I updated my version to 0.36 according to the following command:
pip install weasyprint==0.36

However the error remains

ERROR 2017-06-08 08:49:47,454 creator 6783 140037945554688 Got u'o, ' between two lines. Expected nothing or a preserved line break

@liZe
Copy link
Member

liZe commented Jun 8, 2017

I'd like you to test the current git version

Version 0.36 is not the current git version. You can install it with:
pip install git+https://github.com/Kozea/WeasyPrint.git.

@gsvimieiro
Copy link

OK liZe
Installed according to your instruction but the error remains:

pip install git+https://github.com/Kozea/WeasyPrint.git

Successfully built tinycss2
Installing collected packages: tinycss2
Successfully installed tinycss2-0.5

ERROR 2017-06-08 08:49:47,454 creator 6783 140037945554688 Got u'o, ' between two lines. Expected nothing or a preserved line break

@gsvimieiro
Copy link

Dear liZe

I'm Sorry

The problem was browser caching. I updated my environment again and now it did not give more error. Thank you very much

@liZe
Copy link
Member

liZe commented Jun 8, 2017

Hey @gsvimieiro, you've got exactly the same error as @PauloTeixeiraJunior? What a surprise! Are you some new kind of twins, or what?

Good to see that your issue is now fixed.

@liZe liZe closed this as completed Jun 8, 2017
netbsd-srcmastr referenced this issue in NetBSD/pkgsrc 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 <https://github.com/Kozea/WeasyPrint/issues/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 <https://github.com/Kozea/WeasyPrint/issues/437>`_:
  Support local links in generated PDFs.

Bug fixes:

* `#412 <https://github.com/Kozea/WeasyPrint/issues/412>`_:
  Use a NullHandler log handler when WeasyPrint is used as a library.
* `#417 <https://github.com/Kozea/WeasyPrint/issues/417>`_,
  `#472 <https://github.com/Kozea/WeasyPrint/issues/472>`_:
  Don't crash on some line breaks.
* `#327 <https://github.com/Kozea/WeasyPrint/issues/327>`_:
  Don't crash with replaced elements with height set in percentages.
* `#467 <https://github.com/Kozea/WeasyPrint/issues/467>`_:
  Remove incorrect line breaks.
* `#446 <https://github.com/Kozea/WeasyPrint/pull/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
Labels
bug Existing features not working as expected crash Problems preventing documents from being rendered
Projects
None yet
Development

No branches or pull requests

3 participants