Questions tagged [syntaxerror]

An error which occurs when a program does not follow the syntactical rules of the programming language.

Filter by
Sorted by
Tagged with
3 votes
1 answer
86 views

Using PyQGIS 3 in Visual Studio Code

I did all the steps in the video below: https://www.youtube.com/watch?v=qobogVuXtJU&list=PLbGkCPlkC_XTAUG5HC1WPhxMuZQnBQ7jU&index=1&t=308s When I run the full Python file, it throws this: ...
Zoltán Dévény's user avatar
0 votes
1 answer
54 views

Field Calculator If Statement

I am new to python and was trying to populate a decade field based on an if else statement on another field that contains parcel years. The code block is below: def ifBlock(Parcel_Year_Built, ...
Androoo's user avatar
0 votes
1 answer
55 views

Copying data from one attribute to another with Python in QGIS

I'm trying to update an attribute in a layer in QGIS with data from a joined field in the same layer. I have looked at a few different instructions and tutorials, but for some reason I can't get all ...
eastwing_imh's user avatar
1 vote
1 answer
144 views

Installing tkinter Python package in QGIS

I am trying to install tkinter so I can open a window, but I get an error. Does someone have a step-by-step process on how to install modules in Python console of QGIS? Error: >>> python -m ...
charliey's user avatar
  • 163
0 votes
1 answer
430 views

ArcPy CalculateGeometryAttributes parameters for area calculation - Failed to execute error

I have a large project I am working on and am stumped on one step. There is a large group of layers (over 40), for each of which I need to (1) add an area column to the attribute table and then (2) ...
arc_user's user avatar
2 votes
1 answer
123 views

If lyr.visible = True

In this very simple code, my program keeps failing at line 4, if lyr.visible = True:, yet if I use Print lyr.visible instead, I receive the response "True" or "False" for each ...
Lee Ann's user avatar
  • 21
0 votes
1 answer
221 views

Importing multiple txt files using PyQGIS

I'm using QGIS v3.26, and cannot seem to get code referenced from another Q&A to work. This is the previous Q&A on this topic that I was looking at: How to create multiple QGIS layers from ...
digital-consolation's user avatar
1 vote
1 answer
412 views

Using ArcPy to iterate through multiple LAZ files and convert them to LAS files with lastools

I'm using Jupyter Notebooks in ArcGIS Pro and I would like to convert multiple .laz files into .las files by using the opensource toolbox 'lastools' and its function 'laszip'. For this I would like to ...
Radde1683's user avatar
  • 193
0 votes
1 answer
168 views

OL-Cesium Uncaught (in promise) SyntaxError

Trying to implement OL-Cesium as an ES6 library following instructions here: https://openlayers.org/ol-cesium/apidoc/#as-an-es6-library-recommended-method Running locally for now and getting the ...
wayoutwest's user avatar
1 vote
1 answer
471 views

Converting working ModelBuilder to Python script reports errors in ArcGIS Pro

I want to learn Python and ArcPy by converting ModelBuilder to Python script. First, I tried to use 'extract by mask' in this way.But it failed. # -*- coding: utf-8 -*- """ ...
jackywang's user avatar
  • 309
0 votes
0 answers
45 views

Calculation problem

Trying to calculate terms and failing.I'm trying to figure out what's the problem? Indicates that all documents are on an external disk and not on the computer. if("area" <=1000, $...
Aviad Elmaliah's user avatar
1 vote
0 answers
105 views

ArcGIS Pro field calculator based on values code [closed]

I'm trying to calculate a field to produce symbol codes for GPS units based on a field "Grade". I've tried cobbling together the code based on samples I found; but got syntax error. The Code:...
RCWO's user avatar
  • 11
2 votes
0 answers
67 views

Property from Expression in Shell Script

I am using qgis_process in a shell script (Linux) to make a buffer using a field as the distance. I can get a buffer from the shell with qgis_process run qgis:buffer INPUT=pt.shp OUTPUT=buffered.shp ...
Alec's user avatar
  • 21
0 votes
1 answer
733 views

Using variable for property name in Google Earth Engine ee.Feature

I would like to know if it is possible to set a property name using a computed variable in GEE. For example, I create the following feature: var feature = ee.Feature(null,{propertyName: 0.85}); and ...
M. Nicolas's user avatar
  • 1,270
0 votes
1 answer
272 views

Invalid syntax on arcpy.conversion.FeatureClasstoFeatureClass()

I am using ArcGIS Pro 2.8.1. In a Python script tool, I am trying to get a list of feature classes as an user supplied input parameter, and export all of them with an additional text string that is ...
sparky's user avatar
  • 450
0 votes
2 answers
43 views

Getting SyntaxError when trying to loop through shapefiles in folder, calculate Euclidean distance and save files with appended name using ArcPy

I want to loop through shapefiles in a folder, calculate Euclidean distance and then save the files in an output folder with an appended name in arcpy. I want the name to be the filename with "...
hbk's user avatar
  • 434
2 votes
1 answer
733 views

QGIS Field Calculator Syntax Error Problem

I never before worked with the field calculator and this problem is driving me nuts ... Interpretationserror: syntax error, unexpected NAME syntax error, unexpected ')', expecting $end My expression ...
bluesharxx's user avatar
0 votes
2 answers
82 views

SyntaxError running AssignDomainToField_management function for ArcMap

I'm trying to set a domain for a feature class field using the below syntax and IDLE keeps giving me an invalid syntax error with no specifics. I can't find which line it's rejecting to even begin ...
HiredPirate's user avatar
0 votes
1 answer
412 views

ArcPy replacing network mapped drive with UNC

I am writing a script in Python to look in the current MXD for paths which are on a mapped network drive instead of the UNC path to the network. However I am getting a syntax error. I am not very ...
Meg0's user avatar
  • 21
0 votes
1 answer
95 views

Ending Python if-then using triple double quote gives EOL while scanning string literal [closed]

I keep getting the same error, I think it's because of how I end my if-then statement. It basically looks like this, except it's much longer (like, 300 lines long). myIfThenVariable="""...
Matt Goodman's user avatar
0 votes
0 answers
37 views

SyntaxError from Python Script tool written using ArcPy

I am in an advanced GIS course and was assigned to create a simple tool that is used in the ArcMap toolbox that allows the user to create a buffer of 100 feet. This is the code that I have so far. ...
Cody E's user avatar
  • 1
-2 votes
1 answer
112 views

SAGA RESAMPLING SYNTAX

How can I solve the problem shown below: I am trying to build a plugin that allows me to resample the raster data to any desired resolution of my choice with 20 being the minimum input value, as ...
De Falasy's user avatar
2 votes
1 answer
919 views

Double precision error on user defined type

There is user defined type which consist of double precision type and integer. It looks like it CREATE TYPE ZOOM_LVL AS ( eps FLOAT8, minptrs INTEGER ); This function is used to set the value to user ...
Dmitriy Kormulev's user avatar
1 vote
0 answers
92 views

Python command for QGIS that iterates over .xyz files doesn't work [closed]

I have a small Python script for QGIS that goes to a folder and iterates over its files and uploads all .xyz files. This is the script: import glob, os dir = r"C:\Users\User\Desktop\xyz_daten" ...
DGIS's user avatar
  • 2,527
1 vote
0 answers
146 views

Error using PST(Place Syntax Tool) in QGIS

I'm working with the PST(Place Syntax Tool) that I want to create segment map (Geometry is LineString) in QGIS. I'm having the problems with these errors below An error has occurred while executing ...
Alice Chen's user avatar
1 vote
2 answers
1k views

Using Select by Attribute within a for loop

I am trying to iterate through a feature layer of counties, using each row as the selection expression for Select by Attribute. This selection will then be used to clip another layer. The goal is to ...
JMVDA's user avatar
  • 389
1 vote
0 answers
634 views

Python Stand Alone Script Parsing error SyntaxError: invalid syntax (line 1)

I'm pretty new to python, but I'm trying to transpose a time field for a set of data I'm working with in ArcMap. I changed the file locations and fields to my needs. However, when I try to run the ...
Ben Finley's user avatar
0 votes
0 answers
161 views

Performing iterative Mosaic in ArcPy?

I'm attempting to complete a batch mosaic operation in ArcMap 10.4.1 Python window. I need to run the Mosaic tool about 80 times for sets of three rasters. Basically I want the second and third raster ...
phdstudentuky's user avatar
1 vote
1 answer
370 views

Syntax error when using concat function

I created a field to display the whole route of several photos in a point layer in order to be able to visualize them on the map. I try to do so by using this expression: concat('C:\Users\DIDAC\...
dmasana's user avatar
  • 63
0 votes
1 answer
60 views

Getting SyntaxError from Coordinate Transformation (points) with ArcPy?

I'm trying to do a coordinate transformation for points with ArcPy in ArcGIS Pro by using x and y coordinates as Input. I tried the following: import arcpy inputSRS = arcpy.SpatialReference(31467) ...
user132397's user avatar
1 vote
2 answers
241 views

ArcMap Python Code gives SyntaxError?

I've encountered an issue implementing a code into ArcMap. The original code was: for fc in fclist: ... arcpy.Clip_analysis(fc, r’C:\GIS_LabManual\Lab10_Manual\Lab10_data\Arb_clip_poly.shp’, r’C:\...
Daniel Joseph's user avatar
1 vote
1 answer
1k views

Can't import custom Toolbox in ArcPy?

I have a custom made Toolbox and I can't make it run. The Toolbox is called toolbox_k and the tool is called sn I did this: arcpy.ImportToolbox(r"C:\Users\user\Desktop\VST\Toolbox_k.tbx", "sn") I ...
user10202223's user avatar
6 votes
2 answers
608 views

PyQGIS standalone script using QGIS 3.2

I want to work with PyQGIS Python 3 using QGIS 3.2 standalone install. I created a simple batch file to work with PyQGIS but I have some errors. Here's the batch file: @echo off SET OSGEO4W_ROOT=C:\...
jessie jes's user avatar
  • 1,061
0 votes
0 answers
43 views

Understanding SyntaxError in ArcPy?

On the line after the field info I continue to get syntax errors and I'm unable to solve this problem myself, please help me. The purpose of the code is to move a given point within a set distance in ...
Adam's user avatar
  • 1
0 votes
1 answer
206 views

arcpy for loop to save shapefiles as .layer files

I have 150 shapefiles in folder in "D:\ss3\polygons". I want to save each polygon as .layer file with the polygon name in "D:\ss3\layers" However, Python displays: "Parsing error SyntaxError: invalid ...
Sebastian Salazar's user avatar
3 votes
3 answers
1k views

Deleting selected rows in ArcPy?

I am new to ArcPy and I am trying to write a code to select specific rows from a shapefile. I wrote this code, which gives back: Parsing error SyntaxError: invalid syntax (line 3) Any suggestions ...
chiara's user avatar
  • 51
23 votes
4 answers
23k views

Using OSGeo4W shell with Python 3

I would like to use OSGeo4W shell with Python 3 but when typing python3 I get the following error: Fatal Python error: Py_Initialize: unable to load the file system codec File "C:\OSGEO4~1\apps\...
bennos's user avatar
  • 2,069
1 vote
1 answer
2k views

Syntax Error related to File Path / Name in ArcPy Script

I'm using ArcGIS Desktop 10.2.2. I'm getting the following error when I run a script in Arc. SyntaxError: EOL while scanning string literal The error message points to the line where I set my ...
Waterman's user avatar
  • 1,217
1 vote
2 answers
244 views

Raster calculator syntax in ArcGIS

I'm trying to apply this equation through the raster calculator in ArcGIS: I'm using this syntax: ( ( ( (Raster) ^ 4 ) - (1-e) * ( Sky T ^ 4 ) ) / e ) ^ 0.25 The raster calculator create a ...
Juan Cordoba's user avatar
0 votes
1 answer
226 views

Invalid syntax on export PDF

I'm getting an invalid syntax error on line 20. Anybody see what's wrong? import arcpy import os geo1 = GetParameterAsText(0) goe2 = GetParameterAsText(1) saveLoc = GetParameterAsText(2) exportLoc = ...
S. Price's user avatar
  • 311
2 votes
1 answer
233 views

Referencing Bookmarks in Alphabetical Order in Python script tool?

I have a custom script tool that is supposed to set up a map layout, by adjusting the scale bar, north arrow, title, and legend. It is then supposed to reference a bookmark and export the layout as a ...
Matt A. 's user avatar
0 votes
0 answers
73 views

No module named "SSUtilities" within Optimized Hot Spot Analysis tool

Background I'm trying to execute Optimized Hot Spot Analysis tool in ArcGIS 10.3 but receive the following error: Additional Information I've had a look at some other tools within the same toolbox ...
Cthulhu's user avatar
  • 236
1 vote
0 answers
240 views

Python Window errors showing when opening up Commands tab in Customize related to Python Add-In?

I'm getting a number of errors in the Python Window on ArcGIS 10.3.1 when going to Customize > Customize Mode... > (Commands Tab) as seen below. The majority of errors are coming from a Python Add-in:...
Gregory Mirth's user avatar
0 votes
1 answer
424 views

Syntax error (python script with arcpy) [closed]

My ArcPy script doesn't run because a syntax error was raised, but I already had checked the syntax and indentation of the entire script. Can anyone help me? The error that was raised points to a ...
Pedro's user avatar
  • 3
2 votes
1 answer
256 views

arcpy.da.UpdateCursor gives SyntaxError? [closed]

I'm trying to use Python to: Do a union between 2 layers (LandTrust and Precincts) - this works Create a field called "Overlap - this works Create a da.UpdateCursor to populate the fields with values ...
Olak's user avatar
  • 135
0 votes
1 answer
505 views

Using LIKE clause in update cursor gives syntax error?

I am trying to write a second update cursor within one script. This requires a LIKE condition to look up a value within the same layer to identify rows to update the field within that layer (first ...
N. Begg's user avatar
  • 313
2 votes
1 answer
229 views

Exporting attachments from FGDB and populating field with picture path

I am trying to export attachments from fGDB and populate fields with the picture link path. I created a script following these instructions http://support.esri.com/en/technical-article/000014520 ...
Vincent Law's user avatar
3 votes
1 answer
1k views

Calculating field with hour from date time field with ArcPy?

This expression works in the field calculator to give me the hour from the datetime field called dtrepor arcpy.time.ParseDateTimeString(!dtrepor!).strftime('%H') But how do I call it in python? I ...
Mary Andrews's user avatar
1 vote
1 answer
321 views

Syntax Error Label Expression Debug

I'm attempting to debug a code for a conditional label expression. The code is based on one i have previously used and did not have any issues. The python code is as follows. def FindLabel ( [TF], [...
G.Daigle's user avatar
1 vote
2 answers
432 views

Field Calculator Parsing error SyntaxError: invalid syntax (line 2)

I'm writing a conditional in the Field Calculator and it's giving me an error of syntax in line 2. Can someone see it? The Code Block is this: def ZFactor(LAT_CENTR) : if (10.000 < math.fabs(...
user89183's user avatar