whatisgithub

What is pywin32?

mhammond/pywin32 — explained in plain English

Analysis updated 2026-06-26

5,557C++Audience · developerComplexity · 2/5Setup · moderate

In one sentence

pywin32 is a Python package that gives your Python scripts direct access to Windows system features like COM automation, Windows services, and the Windows shell API, things not available in standard Python.

Mindmap

mindmap
  root((pywin32))
    What it does
      Windows API access
      COM automation
      Service support
    Use cases
      Office automation
      Run as service
      Shell integration
    Tech stack
      Python
      C++ bindings
      Windows APIs
    Audience
      Windows developers
      Automation scripters
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Automate Microsoft Office applications like Excel or Word from a Python script using COM

USE CASE 2

Run a Python script as a background Windows service that starts automatically with the operating system

USE CASE 3

Control Windows shell objects and interact with system features not available in standard Python

USE CASE 4

Access deep Windows system APIs from Python without writing C++ code

What is it built with?

PythonC++Windows APICOM

How does it compare?

mhammond/pywin32codepanda66/cspostgraduate-408confettifx/the-forge
Stars5,5575,5555,541
LanguageC++C++C++
Setup difficultymoderateeasyhard
Complexity2/51/55/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

System-wide install required for Windows service support, post-install script needs elevated permissions for COM registration.

So what is it?

pywin32 is a Python package that provides access to many of the Windows operating system APIs from Python code. This includes support for COM, the Windows component model that allows programs to talk to each other and to system features like Office applications, Windows shell objects, and Windows services. Without a package like this, Python programs running on Windows have limited access to the deeper parts of the operating system. The package is installed through pip, the standard Python package manager. After installation, a post-install script is available for users who want to set up COM objects or run Python code as a Windows service. The script needs elevated permissions when run at the system level rather than for a single user. Running a Python script as a Windows service is one of the more common use cases. For that to work, pywin32 needs to be installed system-wide so the service account can reach the required DLL files. Services running under the LocalSystem account in particular will not have access to user-specific directories, so the global install path matters. The package covers a broad set of Windows API categories. The documentation exists as a web version of an older help file, and parts of it are auto-generated from the current code while other sections have not been updated in many years. Type stubs for editor support are maintained separately in the Python typeshed project. Installation via standalone .exe installers was discontinued after build 306. The pip package is the current supported way to install and update the library.

Copy-paste prompts

Prompt 1
Using pywin32, write a Python script that opens Excel via COM, creates a new workbook, writes data to cell A1, and saves it as output.xlsx.
Prompt 2
I want to run my Python script as a Windows service using pywin32. Show me the minimal code for a service class that starts, runs a loop, and stops cleanly.
Prompt 3
Help me use pywin32 to watch a Windows directory for file changes using the ReadDirectoryChangesW API and print a message whenever a file is created or modified.

Frequently asked questions

What is pywin32?

pywin32 is a Python package that gives your Python scripts direct access to Windows system features like COM automation, Windows services, and the Windows shell API, things not available in standard Python.

What language is pywin32 written in?

Mainly C++. The stack also includes Python, C++, Windows API.

How hard is pywin32 to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is pywin32 for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.