If this is meant to accommodate the directory already existing, use an `if not os.path.exists(...)` first instead. This could catch a number of exceptions that shouldn't be ignored (like not having permissions to create the directory).  You might like os.makedirs also.