I want to use the following code to change the owner of files:
import os
from getpwnam import pwd
from getgrnam import grp
uid = getpwnam('edamame')[2]
gid = grp.getgrnam('staff')[2]
os.chown('/Users/edamame/workspace/git/chinese_nlp/venv/lib/python3.7/site-packages/psutil/_psosx.py', uid, gid)
But the following errors:
Traceback (most recent call last):
File "/Users/edamame/workspace/git/chinese_nlp/chinese_segmenter1.py", line 6, in <module>
from getpwnam import pwd
ModuleNotFoundError: No module named 'getpwnam'
Process finished with exit code 1
I am using Python 3.7 virtual env in PyCharm. I couldn't find the module called getpwnam to install. Which package should I install? Thanks!