There is a problem in my app that I experienced today, with saving files. The strange thing is that the code should be foolproof here. This is where I get an error:
if not os.path.exists(os.path.abspath(os.path.join(file_path, os.pardir))):
os.makedirs(os.path.abspath(os.path.join(file_path, os.pardir)))
Above returns:
OSError: [Errno 17] File exists: '/home/ubuntu/nfs/somedir'
How could os.path.exists
give another result than os.makedirs
? Is it related to the code or could it be hardware? The path specified is an EBS from AWS mounted into the OS at /home/ubuntu/nfs
. Also, Zabbix sent me an alert about high CPU I/O wait time for saving on disk (didn't mention which disk).
Could it be AWS storage inaccessibility or really there are conditions under which above code won't work? Hosted on Ubuntu Server.