gpt4 book ai didi

Python - "NameError: name ' c_bool' 未定义”

转载 作者:行者123 更新时间:2023-11-30 23:54:30 26 4
gpt4 key购买 nike

我正在尝试使用 python 库 mosquitto 为 maemo 编写程序。我正在使用 libmosquitto 包,它提供了一个 mosquitto.py 库文件 ( http://mosquitto.org/documentation/python/ )。

程序使用以下代码行导入 mosquitto:

import mosquitto

该程序在我的桌面上运行良好,但在设备上失败并出现以下错误:

NameError: name 'c_bool' is not defined

我在设备上使用python2.5。我做错了什么?

最佳答案

c_bool 未在 python 2.5 中定义。 2.6 中的新功能:

http://docs.python.org/library/ctypes.html#ctypes.c_bool

也许你可以通过添加来逃脱

c_bool = c_int

在读取的行之后

from ctypes import *

mosquitto.py中。虽然看起来很粗略...

关于Python - "NameError: name ' c_bool' 未定义”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5128946/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com