Preventing overwriting when using numpy.savetxt
numpy
Solution
You can check if the file already exists before you write your data:
import os
if not os.path.exists('my_file'): numpy.savetxt('my_file', my_array)
Problem
Is there built error handling for prevent overwriting a file when using numpy.savetxt? If 'my_file' already exists, and I run numpy.savetxt("my_file", my_array) I want an error to be generated telling me the file already exists, or asking if the user is sure they want to write to the file.