.PYW

PYW File

Python Windowless Script
Ask a question
QUICK ANSWER

A PYW file is a Python source script that runs silently on Windows - no terminal window appears. It is identical to a .py file in content, but Windows opens it with pythonw.exe instead of python.exe. To open one, install Python from python.org; to edit it, any text editor works. Files from unknown sources can run malicious code invisibly, so review the script before running it.

Developer: Python Software Foundation Category: Developer Files Open standard MIME: text/x-python
OPENS ON Windows macOS Linux
Related: .DO · .MD · .HEX · .XSD

On this page

19k+ extensions indexed
Last reviewed Jun 26, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the PYW file format?

A .pyw file is a Python source script that runs without opening a console window on Windows. Syntactically it is identical to a standard .py file - valid UTF-8 Python source code. The distinction is entirely in the extension: Windows associates .pyw with pythonw.exe, the windowless Python interpreter, rather than the standard python.exe. When a .pyw file is launched, no terminal window appears, making it ideal for GUI applications built with tkinter, wxPython, or PyQt/PySide, and for silent background scripts.

The .pyw convention was established alongside the early CPython Win32 ports in the mid-1990s and was formalised by PEP 397 (Python Launcher for Windows), included with Python since version 3.3. The Python Launcher (py.exe / pyw.exe) reads the file extension to select the appropriate interpreter.

On macOS, some Python distributions supply a pythonw binary for Aqua GUI integration, but .pyw is less commonly used there. On Linux the extension carries no special meaning - console suppression is handled by nohup, process detaching, or the GUI toolkit itself.

A .pyw file may begin with a shebang (#!/usr/bin/env python3) or a coding declaration (# -*- coding: utf-8 -*-), but neither is required. Renaming any .pyw to .py and running it with python.exe always works; a console window will appear in that case.

Security & safety

RISK: MEDIUM

A .pyw file is executable Python code that runs silently without a console window, making malicious scripts harder to detect (no visible terminal). Treat .pyw files from unknown sources the same as any unknown executable. Review the source code in a text editor before running. Python must be installed for the file to execute; without Python the file is harmless.

Format details

in a nutshell
FULL NAMEPython Windowless Scriptaka Python GUI script, pythonw script
DEVELOPERPython Software Foundationsince circa 1994 (Python for Windows; pythonw.exe introduced in early Win32 Python builds)
MIME TYPEtext/x-python
TYPEplain text source script (UTF-8)
STANDARDOpen · royalty-free

Programs that open PYW files

Windows6 apps
Sublime Text Freemium Opens and syntax-highlights .pyw as Python. Use the Python build system to run.
Python (CPython) Open-source Install Python from python.org; double-click the .pyw to execute via pythonw.exe (no console). To edit, right-click > Edit with IDLE.
IDLE (bundled with Python) Open-source Right-click the file > Edit with IDLE, or launch IDLE and open via File > Open.
Visual Studio Code Free Install the Python extension; VS Code treats .pyw identically to .py with full IntelliSense and debugging.
PyCharm Freemium Open the file; configure the run configuration to use pythonw.exe if console suppression is needed during debugging.
Notepad++ (with Python syntax) Open-source Opens the file as text with optional Python syntax highlighting.
macOS2 apps
Python (CPython) Open-source Run via 'pythonw script.pyw' in Terminal (if your Python distribution provides pythonw), or 'python3 script.pyw'.
Visual Studio Code Free Full Python editing support; run/debug with Python extension.
Linux2 apps
Python (CPython) Open-source Run 'python3 script.pyw' in terminal - .pyw is treated as plain Python on Linux.
Visual Studio Code Free Full editing and debugging support for .pyw with Python extension.

Technical details

deep spec
Execution on WindowsLaunched by `pythonw.exe` - the windowless CPython interpreter; no console window is allocated or inherited
SyntaxIdentical to `.py` - valid Python 3 (or Python 2) source code; the extension is the only functional distinction
EncodingUTF-8 plain text; BOM permitted but not recommended (PEP 8)
Windows file-type registration`.pyw` mapped to `pythonw.exe` via Windows registry (`HKEY_CLASSES_ROOT\.pyw`)
Python Launcher supportPEP 397 `py.exe` / `pyw.exe` dispatches `.pyw` files to the windowed launcher (Python 3.3+, Windows)
Console windowNone - `pythonw.exe` discards stdout/stderr unless explicitly redirected to a file or pipe
Primary use caseGUI applications (`tkinter`, `wxPython`, `PyQt`/`PySide`) and silent background scripts
Magic bytesNone - plain UTF-8 text; optional shebang `#!/usr/bin/env python3` or coding declaration at line 1
MIME type`text/x-python`; also `application/x-python`
PlatformWindows (primary); macOS via `pythonw` binary (some distributions); Linux (extension carries no special meaning)
Typical file size1 KB - 1 MB (source code only)
CompatibilityRenaming `.pyw` to `.py` and running with `python.exe` always works; a console window will appear
Related format`.py` - standard Python script; runs via `python.exe` on Windows, allocating a console window
Releasedcirca 1994 (Python for Windows; pythonw.exe introduced in early Win32 Python builds)
Latest versionPython 3.x (current 3.13.x as of 2025); no separate .pyw format version
Open standardYes · royalty-free
Specificationdocs.python.org

PYW conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with PYW files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about PYW files.

Frequently asked questions

What is the difference between .py and .pyw?
The content is identical - both are Python source code. On Windows, .pyw is executed by pythonw.exe, which suppresses the console window. Use .pyw for GUI apps; use .py for scripts that need terminal output.
Why does nothing happen when I double-click a .pyw file?
Either Python is not installed (install from python.org), or the script runs silently in the background (no console). Check Task Manager for python.exe or pythonw.exe processes.
How do I edit a .pyw file?
Open it in any text editor (Notepad, VS Code, IDLE). It is plain text Python code.
Can I run a .pyw file on Linux or macOS?
Yes - run 'python3 script.pyw' from the terminal. The .pyw extension has special meaning only on Windows (via the Python Launcher). On Linux/macOS it is just a Python file.
How do I convert a .pyw to an .exe?
Use PyInstaller: 'pyinstaller --noconsole script.pyw'. This bundles Python and the script into a standalone .exe that needs no Python installation on the target machine.
Is a .pyw file a virus?
Not inherently - it is Python source code. Like any script, it could be malicious if from an untrusted source. Open it in a text editor to review it before running.

References

1Python Docs - Using Python on Windows (pythonw / .pyw)docs.python.org
2PEP 397 - Python Launcher for Windowspeps.python.org

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.PARTPartial Download File
4.EXEWindows Executable (Portable Executable)
5.M4AMPEG-4 Audio File
6.MDMarkdown Document
7.DATProgram Data File (generic)
8.JSONJavaScript Object Notation file
9.JPGJPEG Image
10.NOMEDIAAndroid No-Media Marker File

Related extensions

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z