Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

How to pass mxd as argument

$
0
0
I have a simple script that is doing some parsing of the mxd that I pass it. The script works just fine if I hard code the name of the mxd into the script, however I would like to pass the full path of the mxd to the script when I run it. This seems to be an issue since the examples I have seen all have the “r” in them prior to the path and mxd name. For example(this works by the way):

Code:

mxd = arcpy.mapping.MapDocument(r"C:\Data\GISData\PythonCode\test.mxd")

I’ve tried a number of things but haven’t figured out how to get around this simple problem. For Example:

Code:

mxdIn = sys.argv[0]
mxd = arcpy.mapping.MapDocument(mxdIn)

Also tried:


Code:

mxdIn = sys.argv[0]
mxd = arcpy.mapping.MapDocument(r (mxdIn))


Thanks for your help in advance!

Viewing all articles
Browse latest Browse all 2485

Trending Articles