提问人:Олег Паламарчук 提问时间:11/6/2023 最后编辑:Олег Паламарчук 更新时间:11/17/2023 访问量:62
使用 Buildozer 编译 Kivi 时出错
Error when compiling Kivi using Buildozer
问:
我正在使用命令“bulldozer android deploy”在 Python Kivy 中编译代码。
Kivy version = 2.2.1
bulldozer version = 1.5.0
Python version = 3.0.2
法典:
from kivy.metrics import dp
from kivy.app import MDApp
from kivymd.uix.datatables import MDDataTable
from kivymd.uix.screen import MDScreen
class Example(MDApp):
def build(self):
years = [2017, 2018, 2019, 2020, 2021, 2022, 2023]
self.data_tables = MDDataTable(
# use_pagination= True,
check=True,
column_data=[("Год", dp(30))],
row_data= [(str(year),) for year in years],
sorted_on="Schedule",
sorted_order="ASC",
elevation=2)
self.data_tables.bind(on_check_press=self.on_click_box)
screen = MDScreen()
screen.add_widget(self.data_tables)
return screen
def on_click_box(self, instance_table, current_row):
print(current_row[0])
if __name__ == "__main__":
app = Example()
app.run()
请帮助解决问题。文本错误:
Error compiling Cython file: ------------------------------------------------------------ ... # works only for write. cdef SDL_RWops *rwops = SDL_AllocRW() rwops.hidden.unknown.data1 = <void *>byteio rwops.seek = NULL rwops.read = NULL rwops.write = &rwops_bytesio_write ^ ------------------------------------------------------------ kivy/core/image/_img_sdl2.pyx:35:18: Cannot assign type 'size_t (*)(SDL_RWops *, const void *, size_t, size_t) except? -1' to 'size_t (*)(SDL_RWops *, void *, size_t, size_t) noexcept'. Значения исключений несовместимы. Предлагаю добавить 'noexcept' к типу 'size_t
(SDL_RWops *, const void *, size_t, size_t) 除了?-1'.
Error compiling Cython file: ------------------------------------------------------------ ... cdef SDL_RWops *rwops = SDL_AllocRW() rwops.hidden.unknown.data1 = <void *>byteio rwops.seek = NULL rwops.read = NULL rwops.write = &rwops_bytesio_write rwops.close =&rwops_bytesio_close
我找到了错误所在的文件。下面是出现这种情况的代码片段:
cdef SDL_RWops *rwops_bridge_to_bytesio(byteio):
# works only for write.
cdef SDL_RWops *rwops = SDL_AllocRW()
rwops.hidden.unknown.data1 = <void *>byteio
rwops.seek = NULL
rwops.read = NULL
rwops.write = &rwops_bytesio_write
rwops.close =&rwops_bytesio_close
return rwops
我做了什么来解决这个问题?添加了 noExcept 如错误中所述:
rwops.write = &rwops_bytesio_write noexcept
rwops.close =&rwops_bytesio_close noexcept
答: 暂无答案
评论