Select to view content in your preferred language

Bug in Python API 1.8.1

916
1
10-26-2020 06:26 PM
FraserHand
Frequent Contributor

Hi,

I think there is a bug in the Python API.

When creating a new Table feature and adding it to a webmap I get an error:

AttributeError("'NoneType' object has no attribute 'json'",)

using something like

new_table = Table(new_table_url)
wm.add_table(new_table)

in the add_table function in C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\mapping\_types.py we have

if not isinstance(table, arcgis.features.Table):
raise Exception("Type of object passed in must of type 'Table'")
self.add_layer(table, options)

in  def add_layer(self, layer, options=None):

the first check is 

if options is None:
options = {}
if isinstance(layer, arcgis.features.FeatureLayer) and \
'renderer' not in options:
options['renderer'] = json.loads(layer.renderer.json)

which throws the error because tables obviously don't have renderers.

If you do this

isinstance(table, arcgis.features.Table)
True
isinstance(table, arcgis.features.FeatureLayer)
True

which is why it doesn't work.

Thanks

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

You might want to see if that issue has been address with version 1.8.2, otherwise raise an "Issue" at

GitHub - Esri/arcgis-python-api: Documentation and samples for ArcGIS API for Python 


... sort of retired...
0 Kudos