MCPcopy Create free account
hub / github.com/KratosMultiphysics/Kratos / DeleteFileIfExisting

Function DeleteFileIfExisting

kratos/python_scripts/kratos_utilities.py:8–15  ·  view source on GitHub ↗

This function tries to delete a file It uses try/except to also work in MPI

(file_name)

Source from the content-addressed store, hash-verified

6 KM.Logger.PrintWarning('DEPRECATION-Warning; '+label, ' '.join(map(str,message)))
7
8def DeleteFileIfExisting(file_name):
9 """This function tries to delete a file
10 It uses try/except to also work in MPI
11 """
12 try:
13 os.remove(file_name)
14 except:
15 pass
16
17def DeleteDirectoryIfExisting(directory_name):
18 """This function tries to delete a folder

Callers 15

tearDownMethod · 0.90
test_ping_pongMethod · 0.90
DeleteH5FilesFunction · 0.90
ComputeSensitivityMethod · 0.90
ComputeSensitivityMethod · 0.90
CheckMethod · 0.90
_DeleteExistingFilesMethod · 0.90
ExecuteMethod · 0.90
tearDownMethod · 0.90
tearDownMethod · 0.90
wrapperFunction · 0.90
tearDownMethod · 0.90

Calls 1

removeMethod · 0.45

Tested by 15

tearDownMethod · 0.72
test_ping_pongMethod · 0.72
tearDownMethod · 0.72
tearDownMethod · 0.72
wrapperFunction · 0.72
tearDownMethod · 0.72
tearDownClassMethod · 0.72
tearDownClassMethod · 0.72
tearDownMethod · 0.72
_execute_testsMethod · 0.72
tearDownClassMethod · 0.72
tearDownClassMethod · 0.72