I tested the code below from ArcCatalog 10.5's python console and IDLE+PyScripter. While in ArcCatalog everything works correctly(code is supposed to list available datasets and feature layers), in other python enviroments(IDLE and PyScripter) Datasets and Feature Classes are not shown, only views are listed. No error message is produced, as if my Datasets don't exist.

# Import arcpy module
import arcpy
from arcpy import env    

# Local variables:
databaseConnection = r"C:\Users\UserName\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog\SDENAME.sde"
arcpy.env.workspace = databaseConnection

datasets = arcpy.ListDatasets()
for dataset in datasets:
  • 1
    Could you add some more explanation. Do you get any error or which types of dataset/featureclasses -listed in Catalog python console- are not listed in other editors? – Kadir Şahbaz Oct 2 '18 at 11:06
  • No error, just smaller list. Views and external featureclasses can be seen. Datasets and FeatureClasses inside them - missing. – shika-kun Oct 2 '18 at 13:06
  • I corrected the question. Can you reevalutate and reopen it? – shika-kun Oct 10 '18 at 7:45
  • 1
    I re-opened your question because it now seems to be clear enough. It also seems to be a duplicate. – PolyGeo Oct 10 '18 at 8:04
  • nope. doesn't look like an answer. I get path correctly since I see views and get not error. just invisible dataset. guess it is something related to geodatabase version, not path format issue. – shika-kun Oct 10 '18 at 12:13