Get rid of connections to SDE

When running a script sometimes you can get an error, especially when trying to delete a featureclass – something like:

 

ExecuteError: ERROR 000601: Cannot delete Database Connections\foo.sde\foo.barfc.  May be locked by another application.

 

Use the following to get rid of any SDE connections:

arcpy.ClearWorkspaceCache_management()

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s