Skip to main content

Hello there, 

I am trying to execute some Python using the ArcPy module in a workbench base on this Tutorial, Using Arcpy for FME Feature Processing, but I am getting this error the following error:

Geodatabase Error (-2147220970): Cannot acquire a schema lock because of an existing lock.
Could not open File Geodatabase dataset `C:\Users\’USERNAME’\AppData\Local\Temp\wbrun_1740499345598_2444\fmetmp_24\1740665793794_2528_d\tor470\temp.gdb' for reading
Failed to obtain any schemas from reader 'FILEGDB' from 1 datasets. This may be due to invalid datasets or format accessibility issues due to licensing, dependencies, or module loading. See logfile for more information

 

It the issue seems to be the GeoDatabase is still “open” in memory, but my Google Fu has failed to come up with a fix

Hi ​@brad,

Thanks for reaching out! 
After some quick investigation I found that this could be related to cleaning up your arcpy script.

  • ArcPy maintains locks when cursors, layers, or maps are open.
  • Explicitly delete references at the end of the script.

At the end of your script, add: arcpy.ClearWorkspaceCache_management()

Let me know if this helps!
 


You will probably not get this error in FME if you turn ‘feature caching’ off in workbench. This article gave me alot of knowledge when I was calling ArcPy to process feature classes in a file Geodatabase from FME https://support.safe.com/hc/en-us/articles/25407493532429-Using-Arcpy-for-FME-Feature-Processing


Reply