ArcGIS Server SyntaxError: (unicode error) 'utf-8'

668
2
06-17-2022 03:05 AM
iolea
by
New Contributor II

I am trying to run a script on the arcgis server and we get the following error (attached a screenshot).:

line 40 SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0x97 in position 0: invalid start byte

When I run the script it doesn't give me any kind of error, it only gives us error when it is executed on the server.
Any idea how to solve it?

Tags (2)
0 Kudos
2 Replies
TonyContreras_Frisco_TX
Occasional Contributor III

It sounds like the text of part of the script is unreadable. This has happened to me if I have copied some code from one source to another and the text encoding is different between the two. In my case, the double quote character from Microsoft Word was not compatible with Python IDLE. To avoid this, I copied the code to notepad, then copied that text to the Python editor. Another issue might be if the code is trying to read a file. What is the command on Line 40 in your script?

0 Kudos
iolea
by
New Contributor II

I've tried several times, I've rewritten the script from scratch, I've copied it to Notepad as well and it still doesn't work.

The script runs perfectly on local, it is uploaded to the server and does not give any error, but when I run it on the server, I still get this error.

It seems that when I run the script in arcgis it either adds some lines to the script or keeps saying that there is something it can't read.

  • esriJobMessageTypeError: File "D:\arcgisserver\directories\arcgissystem\arcgisinput\Chik_Den\cdmapszv.GPServer\extracted\p20\chik_den_maps1\cdmapszv.py", line 36 SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0x97 in position 0: invalid start byte
  • This line is the one that is supposed to give error:  

 elm.text = dates.last_threemonths + '—' + dates.current_month

Thanks for your help

0 Kudos