Appendix B. The Python 3.3 Windows Launcher

This appendix describes the new Windows launcher for Python, installed with Python 3.3 automatically, and available separately on the Web for use with older versions. This new launcher provides an extra layer of code that chooses and starts an installed Python. Though it comes with some pitfalls, the launcher provides some much-needed coherence for program execution when multiple Pythons coexist on the same computer.

I’ve written this page for programmers using Python on Windows. Though it is platform-specific by nature, it’s targeted at both Python beginners (most of whom get started on this platform), as well as Python developers who write code to work portably between Windows and Unix. As we will see, the new launcher changes the rules on Windows radically enough to impact everyone who uses Python on Windows, or may in the future.

The Unix Legacy

To fully understand the launcher’s protocols, we have to begin with a short history lesson. Unix developers long ago devised a protocol for designating a program to run a script’s code. On Unix systems (including Linux and Mac OS X), the first line in a script’s text file is special if it begins with a two-character sequence: #!, sometimes called a shebang (an arguably silly phrase I promise not to repeat from here on).

Chapter 3 gives a brief overview of this topic, but here’s another look. In Unix scripts, such lines designate a program to run the rest of the script’s contents, by coding it after ...

Get Learning Python, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.