O'Reilly logo

Python Programming On Win32 by Mark Hammond, Andy Robinson

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

Windows Gotchas

As we have stressed a number of times, Python is cross-platform. Although the sheer market penetration of Windows makes it one of Python’s most popular platforms, it’s still only one of the many operating systems Python has to work with.

Accordingly, there are some features available on other platforms that don’t exist on Windows. To make matters worse, there are a number of features that do work on both platforms, but not in exactly the same way.

Most people who use Python only on Windows never need to worry about these features; they have probably never heard of these functions anyway, and they won’t find further comment on them in this book. But for people moving to Windows from the Unix and Linux worlds, seemingly trivial things can cause much aggravation. Although far from exhaustive, some of the more common gotchas are detailed here.

Text-mode versus binary-mode files

Since the early days of computing (well before Unix), lines in text files were terminated with carriage-return and line-feed characters. This is directly attributable to the early teletype devices that required a command to move the printhead (or carriage) back to the left, and another to eject a new line. The creators of Unix decided the convention was pointless and terminated all lines in text files by the line-feed character, which by then had become known as the newline character. Then the C language came up with a new technique for opening files, such that regardless of the local line-ending ...

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

Start Free Trial

No credit card required