os.mknod()是Mac上的特权电话吗?它总是失败,不允许操作?
<code>In [1]: import os
In [2]: os.mknod("/tmp/test123")
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-2-1b8032a076af> in <module>()
----> 1 os.mknod("/tmp/test123")
OSError: [Errno 1] Operation not permitted
</code>
解决方法:
来自OSX手册页https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/mknod.2.html
<code>Mknod() requires super-user privileges. </code>
除无效参数外的作品
<code>sudo python -c "import os; os.mknod('/tmp/test123')"
</code>
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!