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

Error on set_fill_color() after upgrade to 2.7.6 #963

Closed
Iamrodos opened this issue Oct 18, 2023 · 3 comments
Closed

Error on set_fill_color() after upgrade to 2.7.6 #963

Iamrodos opened this issue Oct 18, 2023 · 3 comments
Labels

Comments

@Iamrodos
Copy link

With upgrade to 2.7.6 from 2.7.5 I get a new error on set_fill_color()

Error details

Here is the error message I now get.

rodos@Rodneys-Mac-mini  % python test.py
Traceback (most recent call last):
  File "est.py", line 7, in <module>
    with pdf.table(first_row_as_headings=False) as table:
  File "/Users/rodos/.pyenv/versions/3.11.1/lib/python3.11/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/Users/rodos/.pyenv/versions/3.11.1/lib/python3.11/site-packages/fpdf/fpdf.py", line 4883, in table
    table.render()
  File "/Users/rodos/.pyenv/versions/3.11.1/lib/python3.11/site-packages/fpdf/table.py", line 266, in render
    self._render_table_row(
  File "/Users/rodos/.pyenv/versions/3.11.1/lib/python3.11/site-packages/fpdf/table.py", line 333, in _render_table_row
    self._render_table_cell(
  File "/Users/rodos/.pyenv/versions/3.11.1/lib/python3.11/site-packages/fpdf/table.py", line 443, in _render_table_cell
    draw_box_borders(
  File "/Users/rodos/.pyenv/versions/3.11.1/lib/python3.11/site-packages/fpdf/table.py", line 25, in draw_box_borders
    pdf.set_fill_color(*fill_color)
  File "/Users/rodos/.pyenv/versions/3.11.1/lib/python3.11/site-packages/fpdf/fpdf.py", line 1021, in set_fill_color
    self.fill_color = _convert_to_drawing_color(r, g, b)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rodos/.pyenv/versions/3.11.1/lib/python3.11/site-packages/fpdf/fpdf.py", line 4946, in _convert_to_drawing_color
    return drawing.DeviceRGB(r / 255, g / 255, b / 255)
                                      ~~^~~~~
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

Minimal code

from fpdf import FPDF

pdf = FPDF()

pdf.add_page()
pdf.set_font("helvetica","",10)
with pdf.table(first_row_as_headings=False) as table:
	row = table.row()
	pdf.set_fill_color(200)
	row.cell("Hello")
pdf.output("delete.pdf")

Environment
Please provide the following information:

  • Operating System: Windows and Mac OSX
  • Python version: 3.11.1
  • fpdf2 version used: 2.7.6
@Lucas-C
Copy link
Member

Lucas-C commented Oct 18, 2023

Thank you for the bug report @Iamrodos

I opened #964 to fix this

@Lucas-C
Copy link
Member

Lucas-C commented Oct 18, 2023

@allcontributors please add @Iamrodos for bug

@allcontributors
Copy link

@Lucas-C

I've put up a pull request to add @Iamrodos! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants