Hello Alexandre,
Again, there's no reason to check the attributes first. Just try to open the file and handle the failure.
Sorry, I misunderstood. I thought it was best practice to check if it exists before trying to open it.
Regards, Fabian Maurer