O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Python Programming On Win32

Book Description

Python is growing in popularity; based on download statistics, there are now over 450,000 people using Python, and more than 150,000 people using Python on Windows. Use of the language has been growing at about 40% per year since 1995, and there is every reason to believe that growth will continue.Despite Python's increasing popularity on Windows, Python Programming on Win32 is the first book to demonstrate how to use it as a serious Windows development and administration tool. Unlike scripting on Unix, Windows scripting involves integrating a number of components, such as COM or the various mail and database APIs, with the Win32 programming interface. While experienced Windows C++ programmers can find their way through the various objects, most people need some guidance, and this book is it. It addresses all the basic technologies for common integration tasks on Windows, explaining both the Windows issues and the Python code you need to glue things together.Topics include:

  • The Python language and the PythonWin extensions
  • Building a GUI with COM
  • Adding a Macro language
  • Distributing the application
  • Client-side COM for output and data access
  • Integration with mail and other internet protocols
  • Managing users and drives
This is a vital and unique book. Python Programming on Win32 is an excellent presentation of Windows application development and a solid illustration of how to use Python in the Windows environment.

Table of Contents

  1. A Note Regarding Supplemental Files
  2. Copyright
  3. Preface
    1. About This Book
    2. Who Is This Book for?
    3. How the Book Is Organized
      1. Part I
      2. Part II
      3. Part III
      4. Part IV
    4. About the Examples
    5. Font Conventions Used in This Book
    6. How to Contact Us
    7. Acknowledgments
  4. 1. Introduction to Python
    1. 1. What Is Python?
      1. 1.1. Language Features
      2. 1.2. Python as an Integration Tool
        1. 1.2.1. Working with Files
        2. 1.2.2. Working with DLLs and C Programs
        3. 1.2.3. COM
        4. 1.2.4. Networking
        5. 1.2.5. Distributed Objects
        6. 1.2.6. Where Python Fits in the Development Picture
      3. 1.3. Case Studies of Python Deployment
        1. 1.3.1. A Japanese Python?
        2. 1.3.2. There’s a Python on the Scoreboard!
        3. 1.3.3. Other Python Sightings in the Wild
      4. 1.4. The Python Community
      5. 1.5. Installation and Setup
      6. 1.6. Conclusion
    2. 2. Python Language Review
      1. 2.1. A Crash Course
        1. 2.1.1. Numbers, Strings, and Variables
        2. 2.1.2. Lists and Tuples
        3. 2.1.3. Control Structures
        4. 2.1.4. Functions
        5. 2.1.5. Dictionaries
        6. 2.1.6. Modules
        7. 2.1.7. Classes
        8. 2.1.8. Exception Handling
      2. 2.2. Conclusion
      3. 2.3. References
    3. 3. Python on Windows
      1. 3.1. The Python Core on Windows
        1. 3.1.1. The Windows Registry
        2. 3.1.2. Windows Explorer Integration
        3. 3.1.3. Using the Windows Command Prompt
          1. 3.1.3.1. Running Python programs
          2. 3.1.3.2. Command-line editing
          3. 3.1.3.3. Copy and Paste from the command prompt
        4. 3.1.4. Windows Gotchas
          1. 3.1.4.1. Text-mode versus binary-mode files
          2. 3.1.4.2. Fork
          3. 3.1.4.3. Select
          4. 3.1.4.4. Pipes
      2. 3.2. The Python for Windows Extensions
        1. 3.2.1. Win32 Extensions
        2. 3.2.2. PythonWin
        3. 3.2.3. PythonCOM
      3. 3.3. The Python Imaging Library (PIL)
      4. 3.4. PyOpenGL
      5. 3.5. Web Publishing Tools
        1. 3.5.1. Medusa
        2. 3.5.2. Zope
      6. 3.6. The mx Extensions
        1. 3.6.1. mxDateTime
        2. 3.6.2. mxTextTools
        3. 3.6.3. mxODBC
        4. 3.6.4. mxStack
        5. 3.6.5. mxTools
        6. 3.6.6. mxCrypto
        7. 3.6.7. mxProxy
      7. 3.7. Scientific Tools
      8. 3.8. XML
      9. 3.9. Conclusion
    4. 4. Integrated Development Environments for Python
      1. 4.1. The PythonWin IDE
        1. 4.1.1. The PythonWin Environment
          1. 4.1.1.1. Running scripts
          2. 4.1.1.2. Import modules
          3. 4.1.1.3. Checking modules
          4. 4.1.1.4. Locating source files
        2. 4.1.2. Command-Line Parameters
        3. 4.1.3. The Interactive Window
        4. 4.1.4. The Python Editor
        5. 4.1.5. Python Path Browser
        6. 4.1.6. Object Browser
        7. 4.1.7. Windows Explorer Integration
        8. 4.1.8. The Debugger
          1. 4.1.8.1. Hard breakpoints
      2. 4.2. IDLE
        1. 4.2.1. Platforms and Versions
        2. 4.2.2. Shell Window
        3. 4.2.3. The Python Editor
        4. 4.2.4. Path and Class Browsers
        5. 4.2.5. Running and Importing Scripts
        6. 4.2.6. The Debugger
          1. 4.2.6.1. Postmortem debugging
      3. 4.3. Conclusion
    5. 5. Introduction to COM
      1. 5.1. What It Is
      2. 5.2. Using COM Objects from Python
      3. 5.3. Implementing COM Objects with Python
      4. 5.4. Globally Unique Identifiers
      5. 5.5. Conclusion
  5. 2. Building an Advanced Python Application
    1. 6. A Financial Modeling Toolkit in Python
      1. 6.1. Doubletalk
      2. 6.2. A Crash Course in Accounting
        1. 6.2.1. Transactions
        2. 6.2.2. The Chart of Accounts
          1. 6.2.2.1. Timing considerations
        3. 6.2.3. Back to Python
          1. 6.2.3.1. Dates and times
        4. 6.2.4. Coding Transactions
        5. 6.2.5. BookSets
          1. 6.2.5.1. Adding persistence: Pickles last forever
          2. 6.2.5.2. Summary of the BookSet API
        6. 6.2.6. Storing Extra Information in Transactions
      3. 6.3. The Doubletalk Toolkit at Work
        1. 6.3.1. Comparing, Combining, and Contrasting Accounts
        2. 6.3.2. Building Business Models
        3. 6.3.3. Multidimensional Analysis of Financial Data
        4. 6.3.4. Cash-Flow Analysis
        5. 6.3.5. Putting It Together
      4. 6.4. Conclusion
    2. 7. Building a GUI with COM
      1. 7.1. Designing COM Servers
      2. 7.2. A VB Client
        1. 7.2.1. Building the First View
        2. 7.2.2. More About Transactions
        3. 7.2.3. Adding and Editing Transactions
        4. 7.2.4. Building Views with Arrays
        5. 7.2.5. Graphics and Callbacks
          1. 7.2.5.1. Exposing a graphics API to Python, a more complex example
        6. 7.2.6. Debugging COM Servers
      3. 7.3. Writing a Delphi User Interface
        1. 7.3.1. Instantiating the Server
          1. 7.3.1.1. Calling simple methods
        2. 7.3.2. Unpacking Variant Arrays
          1. 7.3.2.1. Callbacks, or the lack thereof
      4. 7.4. Conclusion
    3. 8. Adding a Macro Language
      1. 8.1. Dynamic Code Evaluation
        1. 8.1.1. Executing Commands and Evaluating Expressions
        2. 8.1.2. Grabbing Python’s Output
        3. 8.1.3. Building an Interactive Console
        4. 8.1.4. Industrial-Strength Consoles
        5. 8.1.5. Executing Scripts
        6. 8.1.6. Importing a Module
        7. 8.1.7. Providing a Startup Script
        8. 8.1.8. Defining User and System-Code Directories
      2. 8.2. Making an Application Extensible
        1. 8.2.1. Changing the Delegate Class
        2. 8.2.2. A Delegation Framework for Responding to Events
        3. 8.2.3. Views and Validators
        4. 8.2.4. A User-Defined View: The Backend
        5. 8.2.5. A User-Defined View: The Front End
        6. 8.2.6. User-Defined Validations
        7. 8.2.7. More Ways to Extend the Application
        8. 8.2.8. A Note on Performance
      3. 8.3. Conclusion
    4. 9. Integration with Excel
      1. 9.1. Client-Side COM and the Excel Object Model
        1. 9.1.1. Starting Excel
        2. 9.1.2. Navigating Through Collections
        3. 9.1.3. Keyword Arguments
        4. 9.1.4. Passing Data In and Out
        5. 9.1.5. Accessing Ranges
        6. 9.1.6. Arrays
      2. 9.2. Excel Concluded
      3. 9.3. Putting It All Together: Importing Financial Data
      4. 9.4. Server-Side COM Again: Excel as a GUI
      5. 9.5. Conclusion
      6. 9.6. References
    5. 10. Printed Output
      1. 10.1. Business Requirements
        1. 10.1.1. Different Document Models
        2. 10.1.2. Methodologies and Lessons from Experience
        3. 10.1.3. Output Formats
      2. 10.2. Automating Word
        1. 10.2.1. A Simple Example
        2. 10.2.2. Using a Template
        3. 10.2.3. A Document Wrapper
        4. 10.2.4. Adding Paragraphs and Styles
        5. 10.2.5. Tables
        6. 10.2.6. Adding a Chart
        7. 10.2.7. Putting It Together
        8. 10.2.8. Inserting HTML and Other Formats
        9. 10.2.9. Using Python COM Objects From Word
        10. 10.2.10. The Last Word
      3. 10.3. Direct Output to the Printer with Windows
        1. 10.3.1. Choosing a Coordinate System
      4. 10.4. PIDDLE: A Python Graphics API
        1. 10.4.1. Available Backends
        2. 10.4.2. Fonts
        3. 10.4.3. Colors
        4. 10.4.4. Coordinate System
        5. 10.4.5. Canvas Graphics Methods
        6. 10.4.6. Canvas Attributes
        7. 10.4.7. Text Output
        8. 10.4.8. Image Support
        9. 10.4.9. Test Framework
        10. 10.4.10. Video Recorder
      5. 10.5. PostScript
      6. 10.6. Portable Document Format
        1. 10.6.1. The Structure of PDF
        2. 10.6.2. Implementing the Frontend
      7. 10.7. Putting It Together: A High-Volume Invoicing System
        1. 10.7.1. Advanced Techniques and Possibilities with PDF and PIDDLE
      8. 10.8. Conclusion
      9. 10.9. References
    6. 11. Distributing Our Application
      1. 11.1. DCOM
      2. 11.2. Conclusion
  6. 3. Python on Windows Cookbook
    1. 12. Advanced Python and COM
      1. 12.1. Advanced COM
        1. 12.1.1. Interfaces and Objects
        2. 12.1.2. The IDispatch Interface
        3. 12.1.3. Late- Versus Early-Bound IDispatch
        4. 12.1.4. Using or Implementing Objects
        5. 12.1.5. InProc Versus LocalServer Versus RemoteServer
      2. 12.2. Python and COM
      3. 12.3. Using Automation Objects from Python
        1. 12.3.1. Late-Bound Automation
        2. 12.3.2. Early-Bound Automation
          1. 12.3.2.1. Running MakePy
          2. 12.3.2.2. How MakePy works
        3. 12.3.3. Forcing Early or Late Binding
        4. 12.3.4. Differences Between Early and Late Binding
        5. 12.3.5. Using COM Constants
        6. 12.3.6. Passing and Obtaining Python Objects from COM
      4. 12.4. Using Other COM Interfaces
      5. 12.5. Error Handling
      6. 12.6. Implementing COM Objects in Python
        1. 12.6.1. Implementing a COM Server
        2. 12.6.2. Registering Your COM Server
        3. 12.6.3. Error Handling for COM Servers
        4. 12.6.4. Policies
        5. 12.6.5. Wrapping and Unwrapping
        6. 12.6.6. Debugging Python COM Objects
        7. 12.6.7. The Final Sample
      7. 12.7. Python and DCOM
        1. 12.7.1. Configure DCOM on the Remote Machine
        2. 12.7.2. Configure DCOM and the Object on the Local Machine
          1. 12.7.2.1. Testing the object using normal COM
        3. 12.7.3. Testing a Remote Object Using DCOM-Specific Calls
      8. 12.8. Conclusion
    2. 13. Databases
      1. 13.1. DAO, ADO, ODBC, OLEDB, and Other GBFLAs
        1. 13.1.1. Proprietary APIs
        2. 13.1.2. Open Database Connectivity
        3. 13.1.3. Data Access Objects, JET, and Access
        4. 13.1.4. Remote Data Objects
        5. 13.1.5. OLEDB
        6. 13.1.6. ActiveX Data Objects
        7. 13.1.7. So What’s Worth Using?
      2. 13.2. Python’s Database API
      3. 13.3. Getting at Your Data
        1. 13.3.1. Fetching Data with the PythonWin ODBC Module
          1. 13.3.1.1. Update queries
          2. 13.3.1.2. Working with dates
        2. 13.3.2. The mxODBC and mxDateTime Extensions
          1. 13.3.2.1. Enhanced connection control
          2. 13.3.2.2. The mxDateTime package
          3. 13.3.2.3. Support for prepared statements
          4. 13.3.2.4. Calling stored procedures
        3. 13.3.3. Sam Rushing’s ODBC Module
        4. 13.3.4. Connecting with Data Access Objects
        5. 13.3.5. Connecting with ADO
      4. 13.4. A Note on Speed
      5. 13.5. Gadfly, the Pure Python Relational Database
        1. 13.5.1. Interactive Use
        2. 13.5.2. Introspection
        3. 13.5.3. Network Use
        4. 13.5.4. What’s It Good for?
      6. 13.6. Data Laundering with Python
        1. 13.6.1. Data as Rows
        2. 13.6.2. Geometric Operations
        3. 13.6.3. Data as Dictionaries
        4. 13.6.4. Inserting Data into the Destination Database
      7. 13.7. A Three-Tier Architecture with Business Objects
        1. 13.7.1. Dynamic Attributes
        2. 13.7.2. Lazy Fetches
      8. 13.8. Conclusion
      9. 13.9. References
    3. 14. Working with Email
      1. 14.1. SMTP and POP3
        1. 14.1.1. Sending an SMTP Message
        2. 14.1.2. Receiving via POP3
      2. 14.2. Microsoft Exchange/Outlook
        1. 14.2.1. Collaboration Data Objects
          1. 14.2.1.1. Sending a message with CDO
          2. 14.2.1.2. Retrieving a message with CDO
      3. 14.3. Conclusion
    4. 15. Using the Basic Internet Protocols
      1. 15.1. HTTP and HTML
        1. 15.1.1. Fetching Data via HTTP
        2. 15.1.2. Serving Data via HTTP
          1. 15.1.2.1. SimpleHTTPServer.py
          2. 15.1.2.2. Implementing an HTTP redirector
      2. 15.2. FTP
        1. 15.2.1. Fetching Data via FTP
      3. 15.3. NNTP
        1. 15.3.1. Fetching News Articles via NNTP
      4. 15.4. Conclusion
    5. 16. Windows NT Administration
      1. 16.1. Working with Users and Groups
        1. 16.1.1. Obtaining Information About a User or Group
        2. 16.1.2. Creating, Changing, and Deleting Users and Groups
          1. 16.1.2.1. Working with groups
          2. 16.1.2.2. Deleting users
      2. 16.2. Server and Share Information
        1. 16.2.1. Querying Information About Servers
        2. 16.2.2. Working with Share Information
        3. 16.2.3. User and Share Sample
      3. 16.3. Rebooting a Machine
        1. 16.3.1. Obtaining the Necessary Privileges
        2. 16.3.2. Sample Code to Reboot the Current Machine
      4. 16.4. Conclusion
      5. 16.5. References
    6. 17. Processes and Files
      1. 17.1. Portable File Manipulation
        1. 17.1.1. Working with Files on Disk
          1. 17.1.1.1. Working with paths and filenames
          2. 17.1.1.2. Names for temporary files
          3. 17.1.1.3. Getting information about files
          4. 17.1.1.4. Walking through a directory tree
        2. 17.1.2. Working with Python File Objects
          1. 17.1.2.1. Opening a file
          2. 17.1.2.2. Reading a text file into a list
          3. 17.1.2.3. Reading a line at a time
          4. 17.1.2.4. The fileinput module
          5. 17.1.2.5. Reading binary data
      2. 17.2. Native File Manipulation: The win32file Module
        1. 17.2.1. Opening and Creating Files
        2. 17.2.2. Reading and Writing Files
        3. 17.2.3. Overlapped I/O
      3. 17.3. Pipes
        1. 17.3.1. Anonymous Pipes
        2. 17.3.2. Named Pipes
      4. 17.4. Processes
        1. 17.4.1. Portable Process Control: The os Module
          1. 17.4.1.1. os.system
          2. 17.4.1.2. os.execv
          3. 17.4.1.3. os.popen
        2. 17.4.2. Better Process Control: The win32api Module
          1. 17.4.2.1. win32api.WinExec
          2. 17.4.2.2. win32api.ShellExecute
        3. 17.4.3. Ultimate Process Control: The win32process Module
          1. 17.4.3.1. Handles and IDs
          2. 17.4.3.2. Creating processes
          3. 17.4.3.3. Terminating processes
          4. 17.4.3.4. Controlling processes
          5. 17.4.3.5. Putting it all together
      5. 17.5. Conclusion
    7. 18. Windows NT Services
      1. 18.1. Services in Brief
        1. 18.1.1. Service Control Manager
        2. 18.1.2. Starting and Stopping
        3. 18.1.3. User Interface
        4. 18.1.4. Error Reporting and Handling
        5. 18.1.5. Performance Monitor
      2. 18.2. Controlling Services with Python
        1. 18.2.1. Connecting to the SCM
        2. 18.2.2. Connecting to a Service
        3. 18.2.3. Querying the Status of a Service
        4. 18.2.4. Controlling a Service
        5. 18.2.5. Closing Service Handles
        6. 18.2.6. Utility Functions to Simplify Working with Services
      3. 18.3. Reading the Event Log
        1. 18.3.1. Python EventLogRecord Object
        2. 18.3.2. How to Read the Event Log
        3. 18.3.3. A Simpler Way to Read Event Log Records
        4. 18.3.4. Obtaining the Message for an Event Log Record
      4. 18.4. Windows NT Performance Monitor Data
        1. 18.4.1. Anatomy of the Performance Monitor
        2. 18.4.2. Reading the Performance Monitor from Python
          1. 18.4.2.1. Browsing for counters
      5. 18.5. Writing Services in Python
        1. 18.5.1. The Anatomy of a Service
        2. 18.5.2. The Anatomy of a Python Service
        3. 18.5.3. The win32serviceutil.ServiceFramework Class
        4. 18.5.4. The Smallest Possible Python Service
        5. 18.5.5. Installing, Debugging, and Running a Python Service
          1. 18.5.5.1. Installing the service
          2. 18.5.5.2. Starting and stopping the service
      6. 18.6. Sample Service Written in Python
      7. 18.7. Writing to the Event Log
        1. 18.7.1. The servicemanager Module
        2. 18.7.2. Modifying the Service to Add Messages
        3. 18.7.3. Custom Event Log Writing
          1. 18.7.3.1. Registering with the Event Log
          2. 18.7.3.2. Writing to the Log
      8. 18.8. Providing Performance Monitor Information
        1. 18.8.1. Performance Monitor Data from Python
          1. 18.8.1.1. Installing Performance Monitor information
          2. 18.8.1.2. Defining the counters
          3. 18.8.1.3. Updating the counters
          4. 18.8.1.4. Viewing Performance Monitor data
      9. 18.9. A Final Service
      10. 18.10. Conclusion
    8. 19. Communications
      1. 19.1. Serial Communications
        1. 19.1.1. How COM Ports Are Accessed
          1. 19.1.1.1. Timing issues
        2. 19.1.2. The Serial Module
          1. 19.1.2.1. The art of telephone conversation
          2. 19.1.2.2. The Mark III: Reading large amounts of data
          3. 19.1.2.3. The Mark IV and dialogs
          4. 19.1.2.4. Of mice and modems
        3. 19.1.3. The Microsoft Communications Control (MSComm)
      2. 19.2. Remote Access Services
      3. 19.3. Sockets
        1. 19.3.1. A Simple Socket Server
        2. 19.3.2. Communication Between Sockets
        3. 19.3.3. Where to Go from Here
      4. 19.4. Other Communications Tools
        1. 19.4.1. Named Pipes
        2. 19.4.2. Remote Procedure Call (RPC)
      5. 19.5. Conclusion
      6. 19.6. References
    9. 20. GUI Development
      1. 20.1. Tkinter
        1. 20.1.1. Terminology
        2. 20.1.2. Pros and Cons of Tkinter
        3. 20.1.3. Running GUI Applications
          1. 20.1.3.1. “Hello World”
          2. 20.1.3.2. The other end of the World
        4. 20.1.4. Widgets
          1. 20.1.4.1. Core widgets
          2. 20.1.4.2. Dialog and other noncore widgets
          3. 20.1.4.3. Widget properties and methods
        5. 20.1.5. Geometry Management
        6. 20.1.6. Tkinter Sample Code
        7. 20.1.7. Tkinter Conclusion
      2. 20.2. PythonWin
        1. 20.2.1. Introduction to MFC
        2. 20.2.2. The PythonWin Object Model
        3. 20.2.3. Developing a PythonWin Sample Application
        4. 20.2.4. Defining a Simple Framework
        5. 20.2.5. Enhancing the DocumentTemplate
        6. 20.2.6. Enhancing the Document
        7. 20.2.7. Defining the View
        8. 20.2.8. Creating the Application Object
        9. 20.2.9. PythonWin and Resources
        10. 20.2.10. PythonWin Conclusion
      3. 20.3. wxPython
        1. 20.3.1. wxWindows
        2. 20.3.2. wxWindows + Python = wxPython
          1. 20.3.2.1. Where to get wxPython
          2. 20.3.2.2. Where to go from here
        3. 20.3.3. Using wxPython
          1. 20.3.3.1. A simple example
          2. 20.3.3.2. Events in wxPython
        4. 20.3.4. Building a Doubletalk Browser with wxPython
          1. 20.3.4.1. MDI Frame
          2. 20.3.4.2. Icons
          3. 20.3.4.3. Timers
          4. 20.3.4.4. Main menu
          5. 20.3.4.5. wxFileDialog
          6. 20.3.4.6. wxListCtrl
          7. 20.3.4.7. wxDialog and friends
        5. 20.3.5. wxPython Conclusion
    10. 21. Active Scripting
      1. 21.1. Registering the Python Active Script Support
      2. 21.2. Python and Popular Microsoft Applications
        1. 21.2.1. Internet Explorer
        2. 21.2.2. Internet Information Server
        3. 21.2.3. Configuring IIS
        4. 21.2.4. Windows Scripting Host
          1. 21.2.4.1. Blurring the edges: WSH or straight Python
      3. 21.3. Active Debugging
      4. 21.4. How Active Scripting Works
      5. 21.5. Active Script Hosting in Python
      6. 21.6. Conclusion
    11. 22. Extending and Embedding with Visual C++ and Delphi
      1. 22.1. Python and Visual C++
        1. 22.1.1. One Size Doesn’t Fit All
          1. 22.1.1.1. Configuring Visual C++ to build Python or extensions
        2. 22.1.2. Building an Extension Using Visual C++
          1. 22.1.2.1. You take the high road...
          2. 22.1.2.2. ...and I’ll take the low road
            1. 22.1.2.2.1. Create a new project file
            2. 22.1.2.2.2. Modify the project settings
            3. 22.1.2.2.3. Building our project
        3. 22.1.3. Debug Versus Release Builds
        4. 22.1.4. Building Python Itself
        5. 22.1.5. Embedding a Python Interpreter in a C++ Application
      2. 22.2. Simplified Wrapper and Interface Generator
      3. 22.3. Python and Delphi
        1. 22.3.1. Embedding Python in a Delphi Application
        2. 22.3.2. Extending Python with a Delphi DLL
        3. 22.3.3. Accessing Delphi’s Visual Component Library
      4. 22.4. Dynamic DLL Access
        1. 22.4.1. Installation and Setup
        2. 22.4.2. Using WinDll
        3. 22.4.3. C Strings and Passing by Reference
      5. 22.5. References
      6. 22.6. Conclusion
  7. 4. Appendixes
    1. A. Key Python Modules and Functions
      1. A.1. Built-in Types
        1. A.1.1. Truth Value Testing
        2. A.1.2. Boolean Operations
          1. A.1.2.1. Notes
        3. A.1.3. Comparisons
          1. A.1.3.1. Notes
        4. A.1.4. Numeric Types
          1. A.1.4.1. Notes
        5. A.1.5. Bit-String Operations on Integer Types
          1. A.1.5.1. Notes
        6. A.1.6. Sequence Types
          1. A.1.6.1. Notes
        7. A.1.7. More String Operations
        8. A.1.8. Mutable Sequence Types
          1. A.1.8.1. Notes
        9. A.1.9. Mapping Types
          1. A.1.9.1. Notes
        10. A.1.10. Other Built-in Types
          1. A.1.10.1. Modules
          2. A.1.10.2. Classes and class instances
          3. A.1.10.3. Functions
          4. A.1.10.4. Methods
          5. A.1.10.5. Code objects
          6. A.1.10.6. Type objects
          7. A.1.10.7. The null object
          8. A.1.10.8. The ellipsis object
          9. A.1.10.9. File objects
          10. A.1.10.10. Internal objects
          11. A.1.10.11. Special attributes
      2. A.2. Built-in Exceptions
      3. A.3. Built-in Functions
      4. A.4. module sys: System-Specific Parameters and Functions
      5. A.5. module string: Common String Operations
      6. A.6. module os: Miscellaneous OS Interfaces
        1. A.6.1. Process Parameters
        2. A.6.2. File Object Creation
        3. A.6.3. File Descriptor Operations
        4. A.6.4. Files and Directories
        5. A.6.5. Process Management
        6. A.6.6. Miscellaneous System Data
        7. A.6.7. module os.path: Common Pathname Manipulations
    2. B. Win32 Extensions Reference
      1. B.1. Common Win32 Python Objects
      2. B.2. pythoncom Module
      3. B.3. win32api Module
      4. B.4. win32event Module
      5. B.5. win32evtlog Module
      6. B.6. win32file Module
      7. B.7. win32pipe Module
      8. B.8. win32process Module
      9. B.9. Service-Related Modules
        1. B.9.1. win32serviceutil Module
        2. B.9.2. win32service Module
        3. B.9.3. servicemanager Module
      10. B.10. win32net Module
      11. B.11. USER_INFO Structures
        1. USER_INFO_0
        2. USER_INFO_1
        3. USER_INFO_2
        4. USER_INFO_3
        5. USER_INFO_10
        6. USER_INFO_11
        7. USER_INFO_20
        8. USER_INFO_1003
        9. USER_INFO_1005
        10. USER_INFO_1006
        11. USER_INFO_1007
        12. USER_INFO_1008
        13. USER_INFO_1009
        14. USER_INFO_1010
        15. USER_INFO_1011
      12. B.12. SERVER_INFO Structures
        1. SERVER_INFO_100
        2. SERVER_INFO_101
        3. SERVER_INFO_102
        4. SERVER_INFO_402
        5. SERVER_INFO_403
        6. SERVER_INFO_502
        7. SERVER_INFO_503
      13. B.13. GROUP_INFO Structures
        1. GROUP_INFO_0
        2. GROUP_INFO_1
        3. GROUP_INFO_2
        4. GROUP_INFO_1002
        5. GROUP_INFO_1005
      14. B.14. GROUP_USERS_INFO Structures
        1. GROUP_USERS_INFO_1
      15. B.15. LOCALGROUP_USERS_INFO Structures
        1. LOCALGROUP_USERS_INFO_0
      16. B.16. LOCALGROUP_INFO Structures
        1. LOCALGROUP_INFO_0
        2. LOCALGROUP_INFO_1
        3. LOCALGROUP_INFO_1002
      17. B.17. LOCALGROUP_MEMBERS_INFO Structures
        1. LOCALGROUP_MEMBERS_INFO_0
        2. LOCALGROUP_MEMBERS_INFO_1
        3. LOCALGROUP_MEMBERS_INFO_2
        4. LOCALGROUP_MEMBERS_INFO_3
    3. C. The Python Database API Version 2.0
      1. C.1. Python Database API Specification 2.0
      2. C.2. Module Interface
      3. C.3. Connection Objects
      4. C.4. Cursor Objects
      5. C.5. Type Objects and Constructors
        1. C.5.1. Implementation Hints
      6. C.6. Major Changes from Version 1.0 to Version 2.0
      7. C.7. Open Issues
      8. C.8. Endnotes
        1. Note 1
        2. Note 2
        3. Note 3
        4. Note 4
        5. Note 5
        6. Note 6
        7. Note 7
    4. D. Threads
      1. D.1. Python Thread Support
      2. D.2. Win32 Thread Support
        1. D.2.1. Native Win32 Threads
        2. D.2.2. win32event Module
      3. D.3. COM Threading Models
        1. D.3.1. Apartment Living
      4. D.4. What Apartment Do I Live in?
        1. D.4.1. What Are the Apartment Rules?
        2. D.4.2. Apartments Open for Inspection
        3. D.4.3. More Information on COM Threading
      5. D.5. Threads and the User Interface
      6. D.6. Conclusion
  8. About the Authors
  9. Colophon
  10. Copyright