0
votes
0answers
15 views

CreateObject cannot open map document error when cycling through list of MXDs

I have a stand alone Python script that aims to make a list of data sources from a series of folders/sub-folders full of MXDs. However I am continually getting the: CreateObject cannot open map ...
0
votes
1answer
42 views

Loading graph (.grf fle) into MXD using ArcPy?

I have hundreds of pairs of FGDB and associated MXD files. I need to insert a graph in each mxd linked to its corresponding FGDB. No problem creating graph, but stuck on how to get graph into mxd ...
1
vote
1answer
47 views

Updating MXD layer definitionQuery in arcpy is very slow

The code segment below has been extracted from a larger project. In short, I have an MXD which I want to generate multiple PDFs based on different criteria. The code below works. It loops through ...
1
vote
0answers
21 views

Fix broken SDE layers with Arcpy - unexpected error [duplicate]

We are in the middle of our ArcGIS 9.3 to 10.1 migration project and we have a lot of custom map documents (from different users) that among others, point to our current 9.3 SDE database. After our ...
2
votes
1answer
515 views

ArcPy findAndReplaceWorkspacePath not working with Raster Datasets

Situation: I am working on creating a Python script that will replace workspace paths for every layer in a map document in order to fix broken layers after a data migration. The script works except ...
3
votes
1answer
543 views

How to export a mxd to a image with transparent background

I cannot get ArcMap 10.0 or 10.1 to "Export Map" to a png or gif with a transparent background -- no matter what I set the background and transparent colors to. Thus, I created the following script, ...
1
vote
3answers
436 views

How to get index number of list item using Python?

this gives me a list of all 55 layers in my mxd import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layer")[0] for lyr in arcpy.mapping.ListLayers(mxd, ...
7
votes
1answer
542 views

ArcPy method to determine ArcMap document version

Is there a way with ArcPy to identify the version of a Map Document (MXD). I am working on a solution to inventory our MXD's and would like to know if a document is 8.1, 9.2, 10.0, etc. I am ...
2
votes
1answer
424 views

How to access all mxd files in a folder?

I'm a beginner to Python and am trying to figure out how I can access several mxds in a folder. For example, when I want to use the AnalyzeforMSD function in ArcGIS: import arcpy mxd = ...
0
votes
1answer
903 views

Find and Replace data source script

The following script is supposed to find and replace all shapefiles in a mxd (that exist in the folder) to the new SDE data source. No errors when running the script however, when I open the MXD in ...
1
vote
1answer
74 views

Change printer for a specific map document from Arcpy

Is it possible to change the printer for a particular map document from ArcPy? The mxd is saved with the default printer settings, and I know with the PrintMap() function one can specify the printer ...
4
votes
1answer
375 views

Why do I lose my printer settings when saving a copy of mxd from ArcPy?

Judging from the answer to this question, one cannot change the page size etc from ArcPy, so I set up my "template" mxds so my script can save a new copy of it, change data sources etc. This methods ...
1
vote
1answer
438 views

Generate MXD layer info report

I'd like to generate a report about MXD layers for a handful of MXDs. I want the report to display their name, workspace path and scale range settings. I can get the first two with ArcPy but I didn't ...
3
votes
1answer
2k views

error on mxd.save/saveACopy

I'm trying to use arcpy to save an .mxd and am having an issue. It doesn't matter if I use mxd.save or mxd.saveACopy I get the same error. I know it doesn't look like I am doing anything w/ it here, ...
1
vote
1answer
1k views

Use ArcPy to rename MXD layers

I have a MXD with some layers that have parentheses in them. I'd like to rename them via script. Is this a valid approach? import re map = arcpy.mapping.MapDocument("CURRENT") layers = ...
2
votes
4answers
2k views

How to enumerate ArcGIS Server 10 map services with ArcPy

I need to connect to ArcGIS server with ArcPy and enumerate over map services. I need to: Loop through each ArcGIS server map service Stop/Start the service Get the service source document (MXD/MSD) ...
4
votes
1answer
217 views

Removing a Table from several MXD-Files using ArcPy

I'm trying to remove a certain Table (xlsx-File) from some MXD-Files using python, but I can't finguring out how. I tried the code sniplet for removing: import arcpy, os from arcpy import env ...
4
votes
2answers
633 views

arcgis 10, python update raster of mxd file

i wanted to update the raster file in a mxd file using python. for example, i created a.mxd which contains b.tif file in it. now, i obtained c.tif and want to update the a.mxd, i.e. want to delete ...
18
votes
4answers
1k views

Run a Python Script when opening an MXD?

Can anyone tell me how to accomplish this? I want a Python script to run on opening the MXD which would pull an excel worksheet into a GDB and refresh the map. I only want this to happen in this ...