usgs / groundmotion-processing

Parsing and processing ground motion data
Other
54 stars 42 forks source link

Handle failed temp directory deletion #901

Closed gferragu closed 2 years ago

gferragu commented 2 years ago

This is a very kludgy fix of #899 , where shutil.rmtree fails to fully remove temporary directories created in read_directory.py due to the presence of .DS_Store file that is generated if a user looks at the data/raw/ directory in the Mac OS Finder.

For reasons that remain inexplicable and will likely join other mysteries such as "What's the meaning of Stonehenge?", despite failing, if shutil.rmtree is just re-run on the temp directory, it removes it without error.

If anyone experiences this issue or has some insight into its origin, perhaps we can come up with a more elegant solution.