Select to view content in your preferred language

write geoprocessing results to text file?

1772
2
04-28-2016 09:23 AM
TomMagdaleno
Frequent Contributor

I have several feature classes which I truncate and append on a nightly basis.  For some reason one or two fail to append each week and I am left with an empty feature class.  I would like to automate Get Count and write the results to a  text file that I can check each morning or setup to email me the results.  Is their a simple way to do this?

0 Kudos
2 Replies
AdrianWelsh
MVP Honored Contributor

Hi Tom,

What I have done when I ran nightly update scripts is that I made Python email me what the results were each night. I imagine the same can be done with writing to a text file. Though, emailing may help you keep a better log?

Here is an example of using Python to email yourself:

http://naelshiab.com/tutorial-send-email-python/

Here you would just create a variable that would hold your GetCount and other variables you wanted to see and have that be the body of the email message. Plus, you could have the subject of the email indicate whether or not the geoprocess was a success or not.

I hope this helps.

0 Kudos
ChrisSmith7
Honored Contributor

How I handle this...

I have an old legacy geocoding script that takes-in batch CSVs every night... it runs well 99.9% of the time, but very occasionally fails. I have a verbose log written, tying into the geoprocessers' messaging feature, for every file processed (if verbose logging is enabled). I have some error handling in the geoprocessing to continue and attempt a reprocess whenever feasible, and if can't complete, an email is spawned-off with the tasks/log messages for the file as an output.

If you're running into some append failures, you might want to consider writing the processes out to a text file - it was really helpful when I initially developed this task years back.

0 Kudos