In addition to my other suggestion...
You can also use os.path.isfile, to check for the existence of a file instead of os.exists, if you need to be sure it's a file.
Return True if path is an existing regular file. This follows symbolic links, so both islink() and isfile() can be true for the same path.
import os.path
os.path.isfile(fname)
That will allow you to...
- close the application that is creating the lock, ensure that the lock is gone, then save, or
- alter the filename that you are using for the output to copyfeatures
The schema lock should really report why there is a lock in the first place and what is putting the lock on. It is also interesting to note that the file has 0 bytes file size and even if you copy the *.lock file to another location to examine it...there is nothing there to examine, so it is an arc* generated process that creates it.
If you want to find out what has the lock on...and you are using a Windows environment, use the CTRL ALT DEL method to bring up task manager and compare the number in the lock file to the application that is producing it and the username that is creating it...as shown in the image below. Note there is nothing you can do about it except say ... cool! At least I confirmed that it was arcmap producing the lock on one of my shapefiles. Also disabling the application C:\Program Files (x86)\ArcGIS\Desktop10.3\bin\AppROT.exe has no affect as some threads have noted.