Append Existing PDF Document with python

Discussion created by jplay on Jan 25, 2012
Latest reply on Jan 25, 2012 by jplay
I am just starting to work with python scripts, so any help would be greatly appreciated.

I am trying to append an existing PDF document with a single page exported from a Data Drive Page MXD, but I'm having difficulty.

The code is as follows:

import arcpy, os, string

# Script arguments
Page = str(arcpy.GetParameter(0))
outPDFpath = arcpy.GetParameterAsText(1) #Working folder
finalPdf = arcpy.GetParameterAsText(2) #Existing PDF file

#Export Section Map
mxd = arcpy.mapping.MapDocument(r"CURRENT")
ddp = mxd.dataDrivenPages
ddp.currentPageID = int(Page)
tmpPdf = outPDFpath + "temp.pdf"
ddp.exportToPDF(tmpPdf, "CURRENT", resolution = 175)
del mxd, ddp

I continue to get the following error:

Traceback (most recent call last):
File "C:\~Working\tools\Scripts\", line 14, in <module>
AttributeError: 'unicode' object has no attribute 'appendPages'

Failed to execute (ExportSinglePagefromDDP22).

Any suggestions?