Error in executing ExportToPDF (or elsewhere?)

940
4
01-11-2012 09:56 PM
VeraDiaz-Köhli
New Contributor
I've written an application that generates double-sided pdf-Documents. In the main module it loops through up to 1700 numbers and for each of them it generates in an own module the backside-pdf and the frontside-pdf. Back in the main it creates a new empty pdf and appends the frontside and the backside.
This works fine for the first about 700 or so numbers. But then the following error appears as it tries to create the first of the pdfs for this numer:

[PHP]PYTHON ERRORS:
Traceback info:
  File "H:\Moorinventar\FM_OBJEKTBLAETTER\Scripts\Rueckseite.py", line 669, in main
    arcpy.mapping.ExportToPDF(mxd, pdf_doc,"PAGE_LAYOUT")

Error Info:
PageLayoutObject: Error in executing ExportToPDF[/PHP]

(That's how I create my pfd-path:
pdf_doc = os.path.join(pfad_pdf,"Seite_2_" + str(AKT_FM.Nummer) + ".pdf")  )

When I restart the script, beginning at number 700, then it works fine, until the same error appears again after the next about 700 numbers.

I guess the problem is not really the ExportToPDF, but rather something with the file system / folder... (all pdfs are written in the same folder. The back- and frontside-pdf are deleted, once the doublesided-pdf is created).

Any ideas what could be the problem? Thanks in advance!

Vera
Tags (2)
0 Kudos
4 Replies
AndrewChapkowski
Esri Regular Contributor
Could there be an unsupported or null character in the field: str(AKT_FM.Nummer)?
0 Kudos
VeraDiaz-Köhli
New Contributor
Could there be an unsupported or null character in the field: str(AKT_FM.Nummer)?


No, because once the error occurred for one number, it continues to occur for all the following numbers as well (if an error occurs in one of the modules, the main loop doesn't stop but continues with the next number.)

But could it be, that's it has something to do with the way I'm running the script? I'm using PyScripter and started the script by pressing the "run" button.
0 Kudos
JeffBarrette
Esri Regular Contributor
There could be a variety of possibilities.  It could be memory leak (are you watching memory usage during run time?), there could be an issue with the PDF libraries, etc.  We won't really know unless we have a reproducible case.  Is there any way you can package your data and make it available to Support Services so we can evaluate the problem?

Thanks!
Jeff
0 Kudos
VeraDiaz-Köhli
New Contributor
I think my problem had something to do with the memory, as you suggested, Jeff. I got my script running through all the numbers by creating a batch-file and running the script for about 150 numbers at a time.

thanks for your help
Vera
0 Kudos