Select to view content in your preferred language

ArcGIS Pro Python help needed

243
1
05-18-2023 01:09 PM
BenRozwod
New Contributor

Hello everyone,

 

My organization is in need of some python help. We have a script that essentially logs into our organization’s Portal account, reads the data submitted on a corresponding Survey123 form, then creates two output tables summarizing the data collected. It first takes the contents of the survey123 feature layer and dumps them unformatted into a raw data table. This step still completes without error. The script then takes that data and does some complicated formatting of the records to combine them together, reformat dates, make new columns etc. in a python dataframe inside the script and saves it to the second excel file. When the script fails it is during this process, because the error message pops up and this data table is left empty.

 

We have been using this script for years without much issue, but recently this script has completely stopped working after my colleagues and I upgraded ArcGIS Pro to version 3.1.

 

When we go to run the script, we get the following error:

(ValueError: invalid literal for int() with base 10: 'None’).

 

After much discussion internally, we believe that the error is coming from an outdated Pandas function. We believe we have identified where two chunks of code that are potentially outdated:

 

BenRozwod_0-1684440519570.png

 

 

BenRozwod_1-1684440519573.png

 

 

This is our best guess at finding the error location(s), but it is definitely possible that we are wrong about that. This python debugging effort is unfortunately beyond the skill level any of us have using python. If anyone has any ideas as to how to potentially revise these few lines, that would be greatly appreciated!

 

Thank you,

0 Kudos
1 Reply
GregKeith
Occasional Contributor III

The error should give you the line number where it occurred in the traceback section. There are a few different ways to debug and/or use try/except structures, but if you're not up on those, try uncommenting the print(result) line so you can examine the dataframe. Either set a breakpoint, send result to an excel or csv file or comment out following lines so you can see what values you have that might be raising the error.

0 Kudos