Select to view content in your preferred language

Analyze is not working

955
4
Jump to solution
12-09-2020 08:57 AM
Clive_S
Emerging Contributor

Greetings,

I used this script about 8 months ago, working on SQL Server, but I cannot get it working on PostGres??

The ESRI Python example is: 

 

 

https://pro.arcgis.com/en/pro-app/help/data/geodatabases/manage-postgresql/update-statistics.htm#ESRI_SECTION1_EB0B43256A2B4027AF7E3246FD0EADCE

Error is at the dataList??
dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListRasters()
print(dataList)

 

 

Because of the no data error I added:

 

tbldataset = arcpy.ListDatasets(feature_type='Tables')
featdataset = arcpy.ListDatasets(feature_type='FeatureClasses')
rastdataset = arcpy.ListDatasets(feature_type='Rasters')

ListTables = tbldataset
ListFeatureClasses = featdataset
ListRasters = rastdataset

 

 

Appreciate a pointer where this is going wrong??

Regards,

Clive 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

The traceback shows multiple "List" functions are returning Python None.  The List functions will return empty lists when nothing is found and will return Python None when the workspace isn't valid.  So, you should look upstream in your code to see how you are setting your environment workspace before calling these functions.

View solution in original post

4 Replies
JoshuaBixby
MVP Esteemed Contributor

Cannot get it working?  What isn't working, exactly?  Are you getting an error or unexpected results?  If an error, it helps to paste the error and traceback for people to see.  if unexpected results, what you are expected and what are you getting?

0 Kudos
Clive_S
Emerging Contributor

Hi Joshua,

I was expecting to return all datasets within SDE. I am getting no data, thought I stated that in first post.

TypeError Traceback (most recent call last) <ipython-input-24-772e862cda86> in <module> 37 38 ---> 39 dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListRasters() 40 print(dataList) 41 TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'

Don't get why there is a no data error??

 

0 Kudos
Clive_S
Emerging Contributor

Greetings,

It was a user issue, the same first part of the script works for non-admin tasks.

Regards,

Clive

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

The traceback shows multiple "List" functions are returning Python None.  The List functions will return empty lists when nothing is found and will return Python None when the workspace isn't valid.  So, you should look upstream in your code to see how you are setting your environment workspace before calling these functions.