Workaround for "TypeError: 'NoneType' object is not subscriptable" in ArcGIS Import data Tutorial

32 Views Asked by At

I'm trying to follow this ArcGIS tutorial. I'm receiving a TypeError: 'NoneType' object is not subscriptable. This happens when I try to execute csv_item = gis.content.add(trailhead_properties, csv_file). Just wondering if anyone else has encountered this error and was able to identify a workaround.

Here is the code I'm running:

from arcgis import GIS
import os

gis = GIS("<url>", 
          client_id=os.environ.get(token),
          verify_cert=False)

trailhead_properties = {
  "title": "Trailheads",
  "description": "Trailheads imported from CSV file",
  "tags": "LA Trailheads"
}

data_path = r".data\LA_Hub_Datasets\LA_Hub\Datasets"
csv_file = os.path.join(data_path, 'Trailheads.csv')
csv_item = gis.content.add(trailhead_properties, csv_file)

I have downloaded "LA_Hub_Datasets.zip" and extracted it. I had no problems reading this file as a pandas data frame.

I was also looking at another tutorial. I received the same error when I reached the following lines of code:

# create the service
new_service = portal.content.create_service(
    name="My Points",
    create_params=create_params,
    tags="Beach Access,Malibu",
)
0

There are 0 best solutions below