main.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:addons-fm 作者: Punto0 项目源码 文件源码
def get_system_user():
    """Return system user info string, such as USERNAME-EUID"""
    try:
        info = getpass.getuser()
    except ImportError:
        if os.name == 'nt':
            # when there is no 'USERNAME' in environment, getpass.getuser()
            # fail when trying to import 'pwd' module - which is unix only.
            # In that case we have to fallback to real win32 API.
            import win32api
            info = win32api.GetUserName()
        else:
            raise

    euid = getattr(os, 'geteuid', None) # Non available on some platforms
    if euid is not None:
        info = '%s-%d' % (info, euid())
    return info
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号