Module macpath
[hide private]
[frames] | no frames]

Module macpath

Pathname and path-related operations for the Macintosh.

Classes [hide private]
norm_error
Path cannot be normalized
Functions [hide private]
 
normcase(path)
 
isabs(s)
Return true if a path is absolute.
 
join(s, *p)
 
split(s)
Split a pathname into two parts: the directory leading up to the final bit, and the basename (the filename, without colons, in that directory).
 
splitext(p)
Split a path into root and extension.
 
splitdrive(p)
Split a pathname into a drive specification and the rest of the path.
 
dirname(s)
 
basename(s)
 
ismount(s)
 
isdir(s)
Return true if the pathname refers to an existing directory.
 
getsize(filename)
Return the size of a file, reported by os.stat().
 
getmtime(filename)
Return the last modification time of a file, reported by os.stat().
 
getatime(filename)
Return the last access time of a file, reported by os.stat().
 
islink(s)
Return true if the pathname refers to a symbolic link.
 
isfile(s)
Return true if the pathname refers to an existing regular file.
 
getctime(filename)
Return the creation time of a file, reported by os.stat().
 
exists(s)
Test whether a path exists.
 
lexists(path)
Test whether a path exists.
 
commonprefix(m)
Given a list of pathnames, returns the longest common leading component
 
expandvars(path)
Dummy to retain interface-compatibility with other operating systems.
 
expanduser(path)
Dummy to retain interface-compatibility with other operating systems.
 
normpath(s)
Normalize a pathname.
 
walk(top, func, arg)
Directory tree walk with callback function.
 
abspath(path)
Return an absolute path.
 
realpath(path)
Variables [hide private]
  curdir = ':'
  pardir = '::'
  extsep = '.'
  sep = ':'
  pathsep = '\n'
  defpath = ':'
  altsep = None
  devnull = 'Dev:Null'
  supports_unicode_filenames = False

Imports: os, S_IWRITE, ST_MTIME, S_IRGRP, S_IFLNK, ST_INO, S_IXOTH, ST_UID, S_ISSOCK, S_ISLNK, S_IMODE, S_IXUSR, S_IRUSR, ST_NLINK, S_IFBLK, S_IFDIR, ST_ATIME, S_ISFIFO, S_ISUID, S_IRWXU, S_IFCHR, S_ISGID, S_IFREG, S_ISREG, S_IREAD, S_IFIFO, S_IFSOCK, S_ISCHR, S_ISVTX, ST_MODE, S_ISDIR, S_ENFMT, S_IEXEC, ST_CTIME, S_IWOTH, S_IXGRP, S_IRWXG, S_IFMT, S_IWUSR, S_ISBLK, ST_GID, S_IROTH, S_IWGRP, S_IRWXO, ST_DEV, ST_SIZE


Function Details [hide private]

isabs(s)

 

Return true if a path is absolute. On the Mac, relative paths begin with a colon, but as a special case, paths with no colons at all are also relative. Anything else is absolute (the string up to the first colon is the volume name).

split(s)

 

Split a pathname into two parts: the directory leading up to the final bit, and the basename (the filename, without colons, in that directory). The result (s, t) is such that join(s, t) yields the original argument.

splitext(p)

 

Split a path into root and extension. The extension is everything starting at the last dot in the last pathname component; the root is everything before that. It is always true that root + ext == p.

splitdrive(p)

 

Split a pathname into a drive specification and the rest of the path. Useful on DOS/Windows/NT; on the Mac, the drive is always empty (don't use the volume name -- it doesn't have the same syntactic and semantic oddities as DOS drive letters, such as there being a separate current directory per drive).

exists(s)

 

Test whether a path exists. Returns False for broken symbolic links

lexists(path)

 

Test whether a path exists. Returns True for broken symbolic links

normpath(s)

 

Normalize a pathname. Will return the same result for equivalent paths.

walk(top, func, arg)

 

Directory tree walk with callback function.

For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), call func(arg, dirname, fnames). dirname is the name of the directory, and fnames a list of the names of the files and subdirectories in dirname (excluding '.' and '..'). func may modify the fnames list in-place (e.g. via del or slice assignment), and walk will only recurse into the subdirectories whose names remain in fnames; this can be used to implement a filter, or to impose a specific order of visiting. No semantics are defined for, or required of, arg, beyond that arg is always passed to func. It can be used, e.g., to pass a filename pattern, or a mutable object designed to accumulate statistics. Passing None for arg is common.