Tell ArcMap to open and then closed question in code?

847
4
03-01-2017 10:54 AM
PROBERT68
Frequent Contributor

Have a question. How do you tell or write in code to tell ArcMap to open and closed and wait for a few minutes before you go to the next code and then open Arc map and then closed  again ? Is there a syntax or code for that ?

I want to write that on my pyscripter because when I wrote coded to export a lot of PDF from each ArcMap mxd in Citrix and I use Pyscripter on Windows.  Citrix is different world and is not the same as you see ArcGIS on PC/Windows. Citrix is more of like a cloud and uses the internet and is kind of slow to open and closed.

Sometimes when you run it and then some of them will bail it out for no reason. I was thinking  it has something to do with open ArcMap and then closed it after export a pdf and then use del mxd. Yes, it has an image in it and it uses Imagine file.

Let me know if you need further question from me...

Thanks,

0 Kudos
4 Replies
DarrenWiens2
MVP Honored Contributor

Are you sure you need to open ArcMap at all? You can work with things you normally associate with ArcMap (mxds, layers, exporting maps, etc.) from Python (PyScripter) without actually loading the ArcMap application. Are you actually opening the ArcMap application, or just assigning an mxd to a variable?

0 Kudos
PROBERT68
Frequent Contributor

I know it doesn't open it when you see it in front of you but what I am trying to say here is to let the time or to let it wait for a few minutes in between . Get it ?

0 Kudos
DarrenWiens2
MVP Honored Contributor

I suppose you could try something like the following, although I've can't think of a time where hardcoding a sleep time solved the real problem:

import time
time.sleep(60) # wait for 60 seconds‍‍
PROBERT68
Frequent Contributor

I'll try on that one and let you know if that worked.

0 Kudos