I am working with ArcGIS Pro 2.1 and Python 3.6.2. and I am writing a script that involves the
arcpy.ListUsers() function and whenever I run the code I receive the following error:
The SDE workspace can be accessed I have tried the
arcpy.ListFeatureClasses() and the function did not fail or receive an error message; I am also able to open the connection in Catalog.
What can I do to get past this issue (this function is necessary for my script, so it cannot be removed)?
arcpy.ListUsers() function fails whether it is ran in the script or on its own.
Here is the code that I have so far:
# import system modules print("Importing system modules...") import arcpy, os, shutil # crete a temp folder to store a database connection print("Checking for the temp directory...") directory = r"P:\Python" if not os.path.exists(directory): os.makedirs(directory) # check for CGF database connection print("Creating the database connection...") if not arcpy.Exists(r"P:\Python\CGF_temp.sde"): # if non existent, create a connection arcpy.CreateDatabaseConnection_management(directory, "CGF_temp.sde", "SQL_SERVER", "###", "DATABASE_AUTH", "###", "###", "SAVE_USERNAME", "CGF") # set workspace environments # workspace must be a connection file to an ADMIN (sde) connection print("Setting the workspace environments...") arcpy.env.workspace = r"P:\Python\CGF_temp.sde" arcpy.env.overwriteOutput = True workspace = arcpy.env.workspace # obtaining a list of connected users print("Obtaining a list of connected users...") users = arcpy.ListUsers("CGF_temp.sde") print(users)