Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [indexerror]

Use this tag when referring to an error resulting when indexing in ArcGIS

2
votes
1answer
36 views

Getting IndexError: list index out of range from arcpy.mapping.ListLayers() in Python Window of ArcMap?

i want to turn on label using arcpy, i use current mxd and my mxd path in my script and my layers also active in the current MXD, but it give me this eror, can somebody help me? here the script i ...
0
votes
1answer
54 views

Using Update Cursor gives IndexError: list assignment index out of range?

I am trying to use an update cursor and receiving an error. I'm not very familiar with using cursors, so please bear with me. I am trying to write a 1 or 0 to a field, based on a condition. The error ...
0
votes
1answer
19 views

IndexError when adding multiple fields to shapefile

As part of a larger project i'm looking to add multiple fields to a shapefile using an index. This is the snippet in question: listFields = [['ITEM', 'TEXT'], ['SYSTEM', 'TEXT'], ['WATERCOURCE_BANK', ...
-1
votes
1answer
25 views

Removing layer from specific data frame using ArcPy gives IndexError?

I work on several maps- each map has different number of data frames (several maps had only 1 or 2 data frames). with this code i try to remove layer "frame" from the third data frame only. I want ...
0
votes
1answer
14 views

IndexError Out of bounds for Graphic Element

I have this error that I'm confused on how to resolve getting this North arrow graphic element from the map document. Code: result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, ...
1
vote
2answers
214 views

Converting .csv file to file.shp using Python gives IndexError?

I have a file.csv like the following: 37.0925854357,14.3860984446,0.0000079572,0.0000939491,0.0000028935 37.0978554286,14.5199850398,0.0000041594,0.0000821038,0.0000047924 37.1029267200,14.6538928343,...
2
votes
1answer
192 views

Apply a definition query to a Layer Group

I'm trying to apply a definition query to multiple layers within a Layer Group by using the following script where I would simply change the values for my 'SUBCODE' field: import arcpy #Variables to ...
1
vote
1answer
123 views

QGIS python error for XY tools plug in, even after installing xlrd and xlw modules!

As I am a complete beginner, I had troubles getting the XY tools plug in running. Now that the xlrd and xlw module error has disappeared after installment of said modules, I can finally choose the X ...
2
votes
1answer
8k views

How to fix a IndexError: string index out of range

I'm still working on my script for vineyards. I need to count row and vine in row. So I code this : #Nombre de rang nbr = QgsExpression( "ID LIKE '%-1'" ) itnbr = layer.getFeatures( QgsFeatureRequest(...
1
vote
2answers
67 views

Exporting each spatial bookmark to jpeg using arcpy gives IndexError?

I have some spatial bookmarks in my MXD file and i want to export each and every bookmark as one jpeg file. I have found below code but it is giving an error. import arcpy mxd = arcpy.mapping....
3
votes
1answer
928 views

Excel to Table failing

I have an arcpy script that works on one machine, but fails very early on another. import arcpy, os arcpy.env.overwriteOutput = True xlFile = r"D:\GIS\mt\data\ExcelTable.xlsx" outGDB = r"D:\GIS\...
2
votes
1answer
223 views

Looping main and Sub-folder in ArcPy [closed]

I am writing a Python script, which can literate through all main folder and Subfolder. My main folder names are 2001, 2002.....and under main folder differents subfolder is there, Subfolder name : ...
2
votes
1answer
2k views

Creating tables on ArcGIS with arcpy?

I'm using python scripts on ArcGIS 10.2 to read excel files with information and put this results on attribute tables of the ArcGIS. I know how to create a table, add rows, add fields and send ...
1
vote
1answer
747 views

Arcpy SearchCursor (arcpy.da) - Assign cursor value to variable [closed]

I am trying to use arcpy.da.SearchCursor to get the values of two field for each reach record in the DISTRICT feature class. I need to assign these values from the table to a two variables varRegion ...
1
vote
1answer
119 views

Cannot access row[1] using arcpy.da.SearchCursor [closed]

My code creates a dissolved feature class with 2 rows. For some reason I am unable to access the 2nd row using the following code: fcCount = arcpy.GetCount_management(fc) print(fc) #2 def ...
1
vote
1answer
675 views

Add CAD feature class to Arcgis using arcpy [closed]

I'm trying to add a CAD layer (point, polyline, annotation...etc) into ArcMap by python code, i'm using Arcgis 10.1, IDLE(Python 2.7), I faced many codes but they all gives errors, so i'm blocked ...
3
votes
2answers
2k views

Use updatcursor to replace values in multiple fields

I have spent a couple days digging through forums here, ESRI help and elsewhere and each variation of the codes I have tried has not worked. As best as I can tell this is due to my attempt to loop ...
1
vote
2answers
2k views

Why does ListLayoutElements give IndexError: list index out of range?

When trying to create a legend on ArcMap use the following Python/ArcPy code I received an error message: import arcpy mxd = arcpy.mapping.MapDocument(r"E:\cities\MyProject.mxd") df = arcpy.mapping....