Хотя поместить данные из tkinter в формат PDF для печати, я запускаю fpdf2 в Python 3.11.3 в Windows 11 Home 23H2.
Строка кода, о которой идет речь, я скопировала. прямо из документации https://py-pdf.github.io/fpdf2/Tables.html.
Код: Выделить всё
with pdf.table() as table:
Код: Выделить всё
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Paul\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 1948, in __call__
return self.func(*args)
^^^^^^^^^^^^^^^^
File "C:\Users\Paul\Dropbox\Work\ProgrammingProjects\cellar\main.py", line 1453, in cellar_to_pdf
with pdf.table() as table:
File "C:\Users\Paul\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 144, in __exit__
next(self.gen)
File "C:\Users\Paul\AppData\Local\Programs\Python\Python311\Lib\site-packages\fpdf\fpdf.py", line 5005, in table
table.render()
File "C:\Users\Paul\AppData\Local\Programs\Python\Python311\Lib\site-packages\fpdf\table.py", line 215, in render
row_info = list(self._process_rowpans_entries())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Paul\AppData\Local\Programs\Python\Python311\Lib\site-packages\fpdf\table.py", line 590, in _process_rowpans_entries
_, img_height, text_height = self._render_table_cell(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Paul\AppData\Local\Programs\Python\Python311\Lib\site-packages\fpdf\table.py", line 496, in _render_table_cell
page_break_text, cell_height = self._fpdf.multi_cell(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Paul\AppData\Local\Programs\Python\Python311\Lib\site-packages\fpdf\fpdf.py", line 226, in wrapper
return fn(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Paul\AppData\Local\Programs\Python\Python311\Lib\site-packages\fpdf\deprecation.py", line 32, in wrapper
return fn(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Paul\AppData\Local\Programs\Python\Python311\Lib\site-packages\fpdf\fpdf.py", line 3652, in multi_cell
text = self.normalize_text(text)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Paul\AppData\Local\Programs\Python\Python311\Lib\site-packages\fpdf\fpdf.py", line 4361, in normalize_text
return text.encode(self.core_fonts_encoding).decode("latin-1")
^^^^^^^^^^^
AttributeError: 'numpy.int64' object has no attribute 'encode'
Поиск в Google «AttributeError: объект 'numpy.int64' не имеет атрибута 'encode'» не дал значимых результатов.
Подробнее здесь: https://stackoverflow.com/questions/790 ... ibuteerror