jaraco.windows

raw JSON →
5.10.0 verified Fri May 01 auth: no python

A library of Windows utilities and ctypes wrappers by Jason R. Coombs, providing convenient access to Windows API functions, registry, file properties, and more. Current version 5.10.0, requires Python >=3.9, and is actively maintained with regular releases.

pip install jaraco-windows
error ModuleNotFoundError: No module named 'jaraco.windows'
cause Package not installed or installed as 'jaraco-windows' but imported as 'jaraco.windows' (correct).
fix
Install the package: pip install jaraco-windows
error AttributeError: module 'jaraco.windows' has no attribute 'registry'
cause Submodules are not automatically imported; you must import them explicitly.
fix
Use 'from jaraco.windows import registry' or 'import jaraco.windows.registry'.
error ImportError: cannot import name 'winreg' from 'jaraco.windows'
cause The winreg alias was removed in version 5.0.
fix
Use 'from jaraco.windows.registry import RegistryKey' or similar.
breaking Version 5.0 removed the deprecated 'winreg' module alias in favor of 'jaraco.windows.registry'.
fix Replace 'import winreg' with 'from jaraco.windows.registry import ...'
breaking Python 3.13 removed the old 'imp' module; jaraco-windows 5.10.0 requires Python >=3.9 but may break on Python 3.13 if dependencies aren't updated.
fix Ensure you are using a compatible Python version (3.9-3.12 recommended).
gotcha Library is Windows-only; importing on non-Windows raises ImportError or AttributeError.
fix Wrap imports in try/except or conditional checks (sys.platform).
deprecated The 'jaraco.windows.filesystem.get_long_pathname' function is deprecated in favor of 'os.path.realpath' (Python 3.10+).
fix Use os.path.realpath instead.

Basic import and registry access; runs on Windows only.

import jaraco.windows.api
import jaraco.windows.registry

# Get a registry key
key = jaraco.windows.registry.RegistryKey(r'SOFTWARE\Microsoft\Windows\CurrentVersion')
print(key['ProgramFilesDir'])

# Use API utilities
jaraco.windows.api.GetCurrentProcessId()