Select to view content in your preferred language

Model Builder versus Python

1376
2
08-01-2016 12:16 PM
JoeBorgione
MVP Emeritus

I have a model that runs well for me.  Just for fun (and to gain a lesson in Python)  I exported the model to a .py file and ran it.  The model runs in about 5 minutes while the Python script version takes about 20 minutes.  Can anyone venture a guess as to why there is such a big difference?  Could it be because of UNC path references?

Dan Patterson

That should just about do it....
0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

Joe, I can't comment on unc paths since I don't have the opportunity to use them.  You should put in some timing steps before and after any path references to check.  There are rumblings about python and unc paths

10.1. os.path — Common pathname manipulations — Python 2.7.12 documentation and again in python 3.5

11.2. os.path — Common pathname manipulations — Python 3.5.2 documentation so you will have to read the top of both sections to see if the reference is still the same.

but I bet it has something to do with backslashesesessess otherwise there wouldn't be support libraries out there

win_unc

DanPatterson_Retired
MVP Emeritus

hmmmm this also suggests issues... it is a medium sized read, but there are a few comments that may apply

arcgis 10.1 - Increasing speed of Python scripts using arcpy - Geographic Information Systems Stack ...