Skip to content

ImportError: cannot import name 'getuid' from 'os'. Did you mean: 'getpid'? #133

@ATATC

Description

@ATATC

Reproduce

This occurs on Windows when calling:

python -m leads_vec info

Cause

getuid() does not exist on Windows platform. This has been known for long, however, in recent commits, this has been added:

    if args.action == "info":
        from leads_vec.__version__ import __version__
        from ._bootloader import frpc_exists as _frpc_exists

        leads_version = "Unknown"
        try:
            leads_version = _package_version("leads")
        except _PackageNotFoundError:
            _L.warn("Failed to retrieve package version (did you install through pip?)")
        _L.info(f"LEADS VeC",
                f"System Platform: {_get_system_platform()}",
                f"Python Version: {_version}",
                f"`frpc` Available: {_frpc_exists()}",
                f"Module Path: {_MODULE_PATH}",
                f"LEADS Version: {leads_version}",
                f"LEADS VeC Version: {__version__}",
                sep="\n")
        _exit()

from ._bootloader import frpc_exists as _frpc_exists will trigger ._bootloader.__init__ which imports all from ._bootloader.systemd. In _bootloader.systemd, the first line leads to the error.

from os import chmod as _chmod, getuid as _getuid

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtodoNew task or assignment

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions