~sthagen/versioalueet#1: 
Fix the failing uname report on windows

the report of environment on windows fails with:

AttributeError: module 'os' has no attribute 'uname'.\
Did you mean: 'name'?
Status
RESOLVED FIXED
Submitter
~sthagen
Assigned to
Submitted
a month ago
Updated
a month ago
Labels
Bug

~sthagen a month ago*

Will work on a minimal workaround like:

def assess() -> EnvType:
    """Assess process environment with standard library functions."""
    if not platform.platform(aliased=True, terse=True).lower().startswith('windows'):
        uname = os.uname()
        os_sysname = uname.sysname
        os_nodename = uname.nodename
        os_version = uname.version
    else:
        os_sysname = 'n/a'
        os_nodename = 'n/a'
        os_version = 'n/a'
    os_cpu_present = os.cpu_count()
    os_cpu_available = len(os.sched_getaffinity(0)) if 'sched_getaffinity' in dir(os) else -1  # type: ignore

~sthagen a month ago*

The next release will trial the following slightly more informative windows variant:

if not platform.platform(aliased=True, terse=True).lower().startswith('windows'):
        os_uname = os.uname()
        os_sysname = os_uname.sysname
        os_nodename = os_uname.nodename
        os_version = os_uname.version
    else:
        pf_uname = platform.uname()
        os_sysname = pf_uname.system
        os_nodename = pf_uname.node
        os_version = pf_uname.version

~sthagen a month ago

Fixed in version 2025.1.6

~sthagen REPORTED FIXED a month ago

Register here or Log in to comment, or comment via email.