
94
|
Python Pocket Reference
errno and the corresponding string, as would be printed
by the C function
perror(). See the module errno in the
Python Library Reference for names of the error codes
defined by the underlying OS.
When exceptions are classes, this exception carries two
attributes:
errno, the value of the C errno variable; and
strerror, the corresponding error message from
strerror(). For exceptions that involve a file pathname
(e.g.,
chdir(), unlink()), the exception instance also
contains the attribute
filename, the filename passed in.
name
Name of OS-specific modules whose names are copied to
the top level of
os (e.g., posix, nt, dos, mac, os2, ce,or
java). See also platform in the section “The sys Mod-
ule,” earlier in this book.
path
Nested module for portable pathname-based utilities.
For example,
os.path.split is a platform-independent
directory name tool that internally uses an appropriate
platform-specific call.
Portability Constants
This section describes tools for parsing and building direc-
tory and search path strings portably. They are automati-
cally set to the appropriate value for the platform on which a
script is running.
curdir
String used to represent current directory (e.g., . for
POSIX,
: for Macintosh).
pardir
String used to represent parent directory (e.g., .. for
POSIX,
:: for Macintosh).
sep
String used to separate directories (e.g., / for Unix, \ for
Windows, or
: for Macintosh).