Unix上的Python::的值找不到os.EX\u

2024-09-28 23:25:56 发布

您现在位置:Python中文网/ 问答频道 /正文

Pythonos模块的文档提供了一组在Unix上可用的退出状态。你知道吗

macOS是Unix。你知道吗

但是,os.EX_NOTFOUND返回

Traceback (most recent call last):
  File "<input>", line 1, in <module>
AttributeError: 'module' object has no attribute 'EX_NOTFOUND'

这是怎么回事?更具体地说,这个常量的值应该是多少?我猜应该是79,但我不知道。你知道吗


Tags: 模块文档mostos状态unixmacoscall
1条回答
网友
1楼 · 发布于 2024-09-28 23:25:56

在退出代码部分的顶部,在os.EX_OK的正上方,它说:

Some of these may not be available on all Unix platforms, since there is some variation. These constants are defined where they are defined by the underlying platform.

所以MacOS平台没有实现它。Linux看起来也一样。我在Solaris上找到了它,它的预期值是79

相关问题 更多 >