""use"python \tools\visitor_edit py string rootdir?add auto-editor startup to searchvisitor in an external subclass componentautomatically pops up an editor on each file containing string as it traversescan also use editor='editor 'notepadon windowsto use texteditor from later in the booktry 'python gui\texteditor\texteditor py'could also send search command to go to the first match on start in some editors""import ossys from visitor import searchvisitor class editvisitor(searchvisitor)""edit files at and below startdir having string ""editor ' :\cygwin\bin\vim-nox exeymmvdef visitmatch(selffpathnametext)os system('% % (self editorfpathname)if __name__ ='__main__'visitor editvisitor(sys argv[ ]visitor run(if len(sys argv else sys argv[ ]print('edited % filesvisited % (visitor scountvisitor fcount)when we make and run an editvisitora text editor is started with the os system command-line spawn callwhich usually blocks its caller until the spawned program finishes as codedwhen run on my machineseach time this script finds matched file during the traversalit starts up the vi text editor within the console window where the script was startedexiting the editor resumes the tree walk let' find and edit some files when run as scriptwe pass this program the search string as command argument (herethe string mimetypes is the search keythe root directory passed to the run method is either the second argument or (the current run directoryby default traversal status messages show up in the consolebut each matched file now automatically pops up in text editor along the way in the followingthe editor is started eight times--try this with an editor and tree of your own to get better feel for how it worksc:\pp \toolsvisitor_edit py mimetypes :\temp\pp \examples :\temp\pp \examples = :\temp\pp \examples\readme-root txt :\temp\pp \examples\pp = :\temp\pp \examples\pp \echoenvironment pyw = :\temp\pp \examples\pp \launchbrowser pyw = :\temp\pp \examples\pp \launcher py = :\temp\pp \examples\pp \launcher pyc skipping :\temp\pp \examples\pp \launcher pyc more output omitted = :\temp\pp \examples\pp \tempparts\lawnlake -jan- jpg visitorwalking directories "++