Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am finding ArcMap runs slower, if you have written a script, which imports arcpy.

You may wish to write a script that can be operated in ArcMap, through the python window, or as a standalone python script. If so, you'll have to import arcpy. However, if you do this and run it in the python window, it will run slower.

share|improve this question
2  
-1 It's ok to post a question and answer it yourself however you should post the answer as an answer. Don't put the answer is the question. Reformulate as question + answer and I'll gladly upvote. –  Sean Jul 19 '11 at 13:25
1  
There you go, fair comment. –  Hairy Jul 19 '11 at 14:12
    
+1 Now, thanks. –  Sean Jul 19 '11 at 14:20
    
nps, cheers Sean –  Hairy Jul 19 '11 at 14:41

2 Answers 2

ArcGIS needs to spin up the runtime (that means loading a fairly sizable number of DLLs) when a process first loads the ArcObjects runtime. It's the same as the time going from the splash dialog in ArcMap to the ArcMap window or the time it takes to spin up an ArcGIS Engine process. In ArcMap the DLLs are already loaded for you so this process has already been done for you.

share|improve this answer
up vote 10 down vote accepted

I have put this code into my script and it runs much quicker:

try:
    arcpy 
except NameError:
    import arcpy

This is saving considerable time in our scripts in ArcMap now.

This may all change in SP2, but none the less...

share|improve this answer
    
thanks for this! –  matt wilkie Aug 3 '11 at 17:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.