arcpy.AddMessage() known limitation?

1507
5
Jump to solution
06-19-2017 08:53 AM
SamyBouma_Ngock1
New Contributor III

No issue with my script as it is running fine but just for my information (or making sure my system is not giving up on me...),

is there a known limitation with arcpy.AddMessage not automatically updating the tool dialog box after ~65500 rows?

However, one can still see the vertical scrollbar update its position upward as new lines are 'added' to the console.

arcpy.AddMessage

0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

It probably isn't coincidence that you are running into issues ~65,500 messages and the maximum value of an unsigned short int is 65,535. 

I can't say for sure whether you are running into a buffer/queue limit, but it seems that way.  That said, that is a fairly excessive amount of messaging (I am differentiating messaging from logging).  Until you do sort out what is happening, maybe using a log file would work better since it seems you want to log millions of events.

View solution in original post

5 Replies
JoshuaBixby
MVP Esteemed Contributor

It probably isn't coincidence that you are running into issues ~65,500 messages and the maximum value of an unsigned short int is 65,535. 

I can't say for sure whether you are running into a buffer/queue limit, but it seems that way.  That said, that is a fairly excessive amount of messaging (I am differentiating messaging from logging).  Until you do sort out what is happening, maybe using a log file would work better since it seems you want to log millions of events.

curtvprice
MVP Esteemed Contributor

Couldn't agree more with Joshua - GP messages are saved both in the current document and to the geoprocessing history by default -- kind of a bad idea to stuff many MB of text messages in both these places!

ClintonDow1
Occasional Contributor II

I agree with Joshua's comment that this limitation is due to the maximum short int value. 

I would recommend either implementing logging to a file instead of messaging to the GP pane as he suggests, using a progress bar, or doing some sort of batching on your messages (ie: only print every 1000 messages using a counter to determine progress)

curtvprice
MVP Esteemed Contributor

Controlling the progress dialog box—Help | ArcGIS Desktop 

This help topic also has the stub code to do something every 1000 records if you want to go the messaging route.

SamyBouma_Ngock1
New Contributor III

Well, thank you all for your feedback.

I understand that I'll have to observe some best practices for messaging and/or logging.

However, the issue I described is a reproducible one since for each run it happens at the same line number. I also noted that when clicking in the console window, line count information gets refreshed... I am not that concerned.

0 Kudos