Hi Community,
We have a python script tool that runs successfully in ArcGIS Pro and we have published it to ArcGIS Enterprise successfully as a WebTool.
On running the tool from REST endpoint we are getting the error of "Unterminated string literal".
Attached is the screenshot.
Attaching snippet of script for reference.
Any inputs on this would be appreciated.
If you look at the error message, it is clear the line 74 in the error message is not the line 74 in the code snippet you posted. Are you showing the code snippet from the Python file on ArcGIS Server or what you ran on Pro?
@JoshuaBixby the code snippet is from Python file on Pro
The publish process change the script. You can find the published script under C:\arcgisserver\directories\arcgissystem\arcgisinput (after the changes)
Sometime the publishing process add some single quote somewhere (I have no idea why).
It is not supported to change the published script directly but if you go there, find the extra quote and delete it you should get it up and running.
Have fun
@ModyBuchbinder If i go to the path mentioned in the screenshot I don't see the python just a toolbox
@ModyBuchbinder & @JoshuaBixby
As suggested, in ArcGIS Pro (ArcGIS Server & Pro are on the same machine) I went to the path mentioned in the screenshot and was able to add the toolbox in the catalog window.
I expanded the toolbox > right clicked on the script too > Edit and was able to remove the extra quotes however, now am getting the following error:
The call to Append is pretty straightforward, nothing obvious like a missing comma. Two ideas come to mind: 1) the field_map object is somehow messed up and not being processed correctly, and 2) maybe it doesn't like the 2 optional arguments by position, so you could try them as named arguments.
Hi all
You used python toolbox where the python code is embedded into the toolbox.
I use simple toolbox where the tool is pointing (by reference) to the script (py separate file).
Then when you publish you get the same structure where you have a py file with the script.
It is easier to handle and you can use IDLE like pycharm that really help you get your code right.
Move to simple py file mean only to copy the execute function into a different file and define new toolbox.
You might deleted something by mistake while editing the toolbox.
Sometime when there is a strange error the problem is really in one of the previous lines.