Skip to content

bug: Windows import fails - os.uname() not available #43

@27Bslash6

Description

@27Bslash6

Bug Description

Importing cachekit on Windows fails with:

AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name'?

Root Cause

src/cachekit/logging.py line 173 uses os.uname().nodename which doesn't exist on Windows:

self._hostname = os.uname().nodename

Reproduction

# On Windows
pip install cachekit
python -c "from cachekit import cache"
# AttributeError: module 'os' has no attribute 'uname'

Suggested Fix

Use platform-agnostic approach:

import platform
self._hostname = platform.node()

Or with fallback:

try:
    self._hostname = os.uname().nodename
except AttributeError:
    self._hostname = platform.node()

Environment

  • cachekit version: 0.3.0
  • Python: 3.13
  • OS: Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions