python - python3.2 不能守护线程吗?

标签 python multithreading python-3.2

我在 Raspberry Pi 2 Model B 上运行 python-3.2 脚本

线程看起来像这样:

myThread = threading.Thread(target=someFunction, args=(arg1,arg2,arg3),
           daemon=True)
myThread.start()

每次调用此线程时。这个错误被触发:

TypeError: __init__() got an unexpected keyword argument 'daemon'

我知道 Debian Wheezy Version 7.10 没有 Python-3.4 稳定版本,因此我必须使用 python 3.2

具有讽刺意味的是,Python 3.2 Documentation确实声明 daemon 是一个可用的 bool 值。

这是什么故障,我该如何解决?

最佳答案

daemon 参数在 3.3 版中添加,see .在以前的版本中设置标志是这样的:

myThread = threading.Thread(target=someFunction, args=(arg1,arg2,arg3))
myThread.daemon = True
myThread.start()

关于python - python3.2 不能守护线程吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38030063/

相关文章:

python - 使用 LDAP 和本地帐户进行 Django Auth

python - 如何跳过要求输入密码的 Fabric 连接?

带有 block 的 Objective-C 调度方法将在 *caller* 线程上运行

javascript - 事件驱动编程node.js?

python - 如何在不转换为列表的情况下替换 python 字符串中特定位置的字母?

python - 复制 Jupyter Notebook Pandas 数据框 HTML 打印输出

python - 在 Selenium Chromedriver、Python 中禁用 CSS 和图像

java - 需要在多线程环境中实现 ArrayList 的傻瓜式同步

python - Python 3 : How/when to call it? 中的 PyEval_InitThreads(传奇继续令人作呕)

python - 获取类型错误 : "POST data should be bytes or an iterable of bytes. It cannot be str." while following simply online example