'MapView' object has no attribute '_preview_image_display_handler'

1090
4
04-04-2021 08:44 AM
Labels (1)
AviBagchi1
New Contributor

I am trying to extract the html code out of an ArcGIS Online map from Python.

     from arcgis.gis import GIS
     import pandas as pd

    g = GIS("https://www.arcgis.com",
    "name", "password")

    p = {
    'type':"CSV",
    'title': '2020#12',
    'snippet':'hwa',
    'description':'test ' + \
    'dataframe object to a GIS item',
    'tags': 'python',

    }

    i=g.content.add (item_properties=p,

   data="C:/Users/Name/PycharmProjects/colors/Map/New.csv"
    )
    q=i.publish ()
    print (q)
    search =
    g.content.search(query="owner:name",
    item_type="Feature Layer")
    print(search)

    map=g.map (location="United States")
    item=search [0]
    print (item)
    map.add_layer(item)

   props={'title': '2020#156',
   'snippet':'hwa',
   'tags': 'python',
   "renderer":"autocast",
   "field_name": "Threat"}

   map.save (props)

   map.embed ()

 

I get an error for called embed ().

   AttributeError: 'MapView' object has no attribute
   '_preview_image_display_handler'


I have tried the export_to_html () method. It throws no error but the html code is invalid when I try and embed it in google sites.



4 Replies
WerkstudentMourik
New Contributor

I'm also running into this issue, it does run in jupyter notebook but not in an IDE

0 Kudos
BengtDahlgrenStockholmGeo
New Contributor III

Running into the same issue in VS code and keen on finding a solution

0 Kudos
BengtDahlgrenStockholmGeo
New Contributor III

Managed to solve this by updating arcgis to v3.0.3 and update .NET Desktop Runtime v6, see

https://community.esri.com/t5/arcgis-pro-questions/super-object-has-no-attribute-ipython-display/m-p...

However, I get another error related to numpy then

0 Kudos
BengtDahlgrenStockholmGeo
New Contributor III

I got the issue again but I think I managed to solve this for good this time.

I think the the map should have been generated at least once before being embedded . This removed the "MapView" error for me. By the way, I am running my code in a notebook and use nbconvert for the html conversion.

0 Kudos