arcgis-python-api
arcgis-python-api copied to clipboard
WebMap.add_table(new_table) fails with AttributeError("'NoneType' object has no attribute 'json'",)
Using ArcGIS Pro 2.6.0
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 don't have renderers.
If you do this
isinstance(table, arcgis.features.Table) True isinstance(table, arcgis.features.FeatureLayer) True