Note that there are some explanatory texts on larger screens.

plurals
  1. POReportLab - Not writing the records that have been looped and stored
    primarykey
    data
    text
    <p>A follow on from this <a href="https://stackoverflow.com/questions/10108467/reportlab-error-when-creating-a-table">question i posted yesterday</a></p> <p>I am able to loop through all of my records, and it gets written to a variable called data which is then appended to another variable called parts, and When I put a watch on the parts variable I can see the correct data, but when it tries to build the pdf ...</p> <pre><code>doc.build(parts) </code></pre> <p>I get the following error</p> <pre><code>AttributeError: 'list' object has no attribute 'getKeepWithNext' </code></pre> <p>Here's the full code</p> <pre><code>import os, arcgisscripting, datetime, string from reportlab.lib.pagesizes import A4 from reportlab.platypus import * from reportlab.lib import colors from reportlab.lib.styles import ParagraphStyle myWorkspace = r"W:\HeartOfTheCity.gdb" myReportFolder = r"W:\Reports" OpenPDF = "true" gp = arcgisscripting.create(9.3) #setup geoprocessor gp.workspace = myWorkspace gp.toolbox = "analysis" gp.OverwriteOutput = 1 mySelectedGroupsFC = myWorkspace + os.sep + "SelectedGroups" myNewBusinessFC = myWorkspace + os.sep + "New_Businesses" myBufferFC = myWorkspace + os.sep + "Buffer" myReportTable = myWorkspace + os.sep + "FINAL_TABLE" #obtain Selected groups mySelGroupsCursor = gp.searchcursor(mySelectedGroupsFC) mySelectedGroups = mySelGroupsCursor.next() #obtain New Business groups myNewBusinessCursor = gp.searchcursor(myNewBusinessFC) myNewBusiness = myNewBusinessCursor.next() #obtain Buffer myBufferCursor = gp.searchcursor(myBufferFC) myBuffer = myBufferCursor.next() #setup PDF doc pdf_file_name = myNewBusiness.Postcode pdf_file = myReportFolder + os.sep + pdf_file_name + ".pdf" doc = SimpleDocTemplate(pdf_file, pagesize=A4) #array of report elements parts = [] # #HEADER # parstyle = ParagraphStyle(name='Title', fontName='Helvetica', fontSize=12, alignment=1, spaceAfter=20) p = Paragraph('&lt;b&gt;&lt;u&gt;Heart of the City Search Report&lt;/u&gt;&lt;/b&gt;', parstyle) parts.append(p) p = Paragraph('The following community groups are located within &lt;b&gt;&lt;u&gt;' + myBuffer.Buffer + ' metres of - &lt;b&gt;&lt;u&gt;' + myNewBusiness.Postcode + '&lt;\b&gt;&lt;\u&gt;.',parstyle) parts.append(p) #Enter while loop for each buffer feature #while myBuffer: while myBuffer: print myBuffer.Buffer parstyle = ParagraphStyle(name='Title', fontName='Helvetica', fontSize=11, alignment=0, spaceAfter=15, spaceBefore =15) p = Paragraph('&lt;b&gt;&lt;u&gt;Community groups within ' + myBuffer.Buffer + ' metres of ' + myNewBusiness.Postcode + '&lt;/u&gt;&lt;\b&gt;&lt;br&gt;', parstyle) parts.append(p) data = [] parstyle = ParagraphStyle(name='Title', fontName='Helvetica', fontSize=11, alignment=0) while mySelectedGroups: selectedGroups_desc = 'Community ID:'+ '&lt;i&gt;' + mySelectedGroups.Community_ID + '&lt;\i&gt;'+ 'Organisation Name :' + mySelectedGroups.Organisation_Name + '&lt;br&gt;' p = Paragraph(selectedGroups_desc, parstyle) data.append(p) #print data mySelectedGroups = mySelGroupsCursor.next() parts.append(data) print parts #print parts myBuffer = myBufferCursor.next() # #FOOTER # parstyle = ParagraphStyle(name='Title', fontName='Helvetica', fontSize=11, alignment=0, spaceAfter=15, spaceBefore=15) p = Paragraph('''Should you have any further questions **''', parstyle) parts.append(p) doc.build(parts) del mySelGroupsCursor, myNewBusinessCursor, myBufferCursor #Open document if OpenPDF == "true": os.startfile(pdf_file) </code></pre> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload