fourth editions of this bookthe original os path walk call was removed in python xand os walk became the only automated way to perform tree walks in the standard library examples from the prior edition that used os path walk were effectively broken by contrastalthough the visitor classes used this calltooits clients did not because updating the visitor classes to use os walk internally did not alter those classesinterfacesvisitor-based tools continued to work unchanged this seems prime example of the benefits of oop' support for encapsulation although the future is never completely predictablein practiceuser-defined tools like visitor tend to give you more control over changes than standard library tools like os walk trust me on thatas someone who has had to update three python books over the last yearsi can say with some certainty that python change is constantplaying media files we have space for just one lastquick example in this so we'll close with bit of fun did you notice how the file extensions for text and binary file types were hardcoded in the directory search scripts of the prior two sectionsthat approach works for the trees they were applied tobut it' not necessarily complete or portable it would be better if we could deduce file type from file name automatically that' exactly what python' mimetypes module can do for us in this sectionwe'll use it to build script that attempts to launch file based upon its media typeand in the process develop general tools for opening media portably with specific or generic players as we've seenon windows this task is trivial--the os startfile call opens files per the windows registrya system-wide mapping of file extension types to handler programs on other platformswe can either run specific media handlers per media typeor fall back on resident web browser to open the file generically using python' webbrowser module example - puts these ideas into code example - pp \system\media\playfile py #!/usr/local/bin/python ""#################################################################################try to play an arbitrary media file allows for specific players instead of always using general web browser scheme may not work on your system as isaudio files use filters and command lines on unixand filename associations on windows via the start command ( whatever you have on your machine to run au files--an audio playeror perhaps web browserconfigure and extend as needed playknownfile assumes you know what sort of media you wish to openand playfile tries to determine media type automatically using python mimetypes moduleboth try to launch web browser with python webbrowser module as last resort when mimetype or platform unknown #################################################################################""playing media files