Does your SDE connection use OS authentication or database authentication? And is the path in your script the actual path to the SDE connection file? Not something like "Database Connections\SDE_admin.sde"?
Most likely cause is the local user isn't authorized to access the database using their OS credentials.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.