I have had a Python 2/ArcMap script to compress enterprise geodatabases. The script has worked fine for a while now. I recently converted the script to Python 3/ArcGIS Pro. Now, I keep getting the same error (see below). I've tried referencing the sde connection files using os.path.join and as a single variable (drive/letter/file). I'm looping through a list of geodatabases.
Error: Failed to execute. Parameters are not valid.
ERROR 000837: The workspace is not the correct workspace type.
Failed to execute (Compress).
FILE: compress_geodatabases.py, LINE: 41
"arcpy.management.Compress(gdb[0])": Failed to execute. Parameters are not valid.
ERROR 000837: The workspace is not the correct workspace type.
Failed to execute (Compress).
Error compressing CCGIS.sde
for gdb in geodatabases:
try:
start_time_compress = time.perf_counter()
arcpy.management.Compress(gdb[0])
end_time_compress = time.perf_counter()
elapsed_time_compress = end_time_compress - start_time_compress
elapsed_time_compress_rounded = round(elapsed_time_compress, 2)
log_message += '\nCompressed {} in {}-seconds\n'.format(gdb[1], elapsed_time_compress_rounded)
except EnvironmentError as e:
log_message += print_errors.print_exception(e)
log_message += '\nError compressing {}\n'.format(gdb[1])
except Exception as e:
log_message += print_errors.print_exception(e)
log_message += '\nError compressing {}\n'.format(gdb[1])