I'm trying to remove a directory that has within it a directory tree structure and files and thought the following would work (the online docs seem to suggest it will remove the underlying directory tree and included files)
shutil.rmtree('test_directory') but I got back an error (Python 2.7 on OSX) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/shutil.py", line 253, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/shutil.py", line 251, in rmtree os.rmdir(path) OSError: [Errno 66] Directory not empty: 'test_directory' which seems to suggest that the directory has to be empty to work ... sort of defeats the purpose of wanting to removing the tree in one command. What do people suggest short of calling os.system('rm -R test_directory'). ------------------------------------------------- Prof Garry Willgoose Australian Professorial Fellow, School of Engineering, The University of Newcastle, Callaghan, NSW, 2308. Australia Phone: +61 2 4921 6050 (Tues-Thurs) +61 2 6545 9574 (Fri-Mon) FAX: +61 2 4921 6991 email: garry.willgo...@newcastle.edu.au g.willgo...@telluricresearch.com --------------------------------------------------- _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor