AnsweredAssumed Answered

Arcpy Error Message

Question asked by BrianHovis on Nov 7, 2013
Latest reply on Nov 8, 2013 by BrianHovis
I am very new to arcpy and am trying to duplicate code from an exampe in ArcGIS 10.2 Desktop Help called "Inserting supporting pages into your map book."  I keep get error messages (mostly refer to line 10), including the one at the bottom of this message.  Any help would be appreciated.  I may be asking too much, because you can't see my file locations.

>>> import arcpy, os
...
... # Create an output location variable
... outDir = r"C:\temp\final_output" 
...  
... # Create a new, empty pdf document in the specified output location folder
... finalpdf_filename = outDir + r"\ArenacMB.pdf"
... if os.path.exists(finalpdf_filename):
...   os.remove(finalpdf_filename)
... finalPdf = arcpy.mapping.PDFDocumentCreate(finalpdf_filename)
...
... # Add the title page to the pdf
... finalPdf.appendPages(r"C:\temp\TITLE.pdf")
...
... # Add the overview map to the pdf
... finalPdf.appendPages(r"C:\temp\AdvancedExport.pdf")
...
... # Export the Data Driven Pages to a temporary pdf and then add it to the
... # final pdf. Alternately, if your Data Driven Pages have already been
... # exported, simply append that document to the final pdf.
... #
... mxdPath = r"C:\temp\MBExample\maps\ArenacDDP Reports.mxd"
... tempMap = arcpy.mapping.MapDocument(mxdPath)
... tempDDP = tempMap.dataDrivenPages
... temp_filename = r"C:\temp\tempDDP.pdf"
... finalPdf.appendPages(temp_filename)
...
...
... # Update the properties of the final pdf
... finalPdf.updateDocProperties(pdf_open_view="USE_THUMBS",
...                              pdf_layout="SINGLE_PAGE")
...
... # Save your result
... finalPdf.saveAndClose()
...
... # Delete variables
... del finalPdf
...
[COLOR="#FF0000"]Runtime error
Traceback (most recent call last):
  File "<string>", line 10, in <module>
  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\mapping.py", line 1679, in PDFDocumentCreate
    return PDFDocument(pdf_path)
  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\arcobjects\_base.py", line 47, in __init__
    for arg in args))
AttributeError: Invalid path
>>>

Outcomes