Skip to main content
 首页 » 编程设计

Python 为 AIX 上的 posix grp 函数提供 NotImplementedError

2025年05月04日14kenshinobiy

我在使用 python 提取 tar 文件时发现了这个问题,使用 tarfile.extractall。该函数适用于其他操作系统,但在 AIX 上我收到源自 getgrnam 的错误。

这是一个非常简单的测试,仅调用 getgrnam:

Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06) 
[IBM J9 VM (IBM Corporation)] on java1.5.0 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 
>>> import grp 
>>> 
>>> file = "test.txt" 
>>> 
>>> grp.getgrnam(file) 
Traceback (most recent call last): 
  File "<stdin>", line 1, in <module> 
  File "/tmp/jython.jar/Lib/grp.py", line 67, in getgrnam 
NotImplementedError: getgrnam unimplemented 

知道为什么会发生这种情况以及可能的解决方案是什么吗?

请您参考如下方法:

AIX 对 Jython 来说并不是 POSIX。