[reportlab-users] Can't get attribute 'NPDFString'

Damien Jones damien at aglakti.com
Wed Mar 3 15:01:12 EST 2021


Hi,

I'm evaluating ReportLab and running into an issue when trying to use 
<catchForms> to read a data file I created using PageCatcher. 

I set up a new virtualenv for ReportLab and installed:

python --version:
Python 3.8.5

pip freeze:
Pillow==8.1.0
Pmw==2.0.2
preppy==3.0.3
pyRXP==2.2.1
reportlab==3.5.61
rlextra==3.5.61

*This is the RML (header.rml):*

<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<!DOCTYPE document SYSTEM "rml.dtd">

<document filename="header.pdf">
    <template pageSize="8.5in, 11in">
        <pageTemplate id="main">
            <pageGraphics>
                <catchForms storageFile="header.data"/>
                <doForm name="os0"/>
            </pageGraphics>
            <frame id="1" x1="1" y1="1" width="100" height="100"></frame>
        </pageTemplate>
    </template>

    <stylesheet>

    </stylesheet>

    <story>
        <para>test</para>
    </story>
</document>

*The data file is generated by:*

*python 
D:\ReportLab\.venv\Lib\site-packages\rlextra\pageCatcher\pageCatcher.py 
makeforms .\SeparatedReport_PDF_Header.pdf -s header.data -p os --test 
os.pdf*

defaulting to first page
Makeforms from '.\\SeparatedReport_PDF_Header.pdf' to 'header.data' page 
numbers [0]
making test grid from %s into %s ("'header.data'", "'os.pdf'")
form 'os0'
wrote test file 'os.pdf'

created forms: ['os0'] in 'header.data'
defaulting to first page
Makeforms from '.\\SeparatedReport_PDF_Header.pdf' to 'header.data' page 
numbers [0]
making test grid from %s into %s ("'header.data'", "'os.pdf'")
form 'os0'
wrote test file 'os.pdf'

created forms: ['os0'] in 'header.data'

*Generating the PDF:*
*python D:\ReportLab\.venv\Lib\site-packages\rlextra\rml2pdf\rml2pdf.py 
.\header.rml*

Traceback (most recent call last):
  File "D:\ReportLab\.venv\Lib\site-packages\rlextra\rml2pdf\rml2pdf.py", 
line 15, in <module>
    __bootstrap()
  File "D:\ReportLab\.venv\Lib\site-packages\rlextra\rml2pdf\rml2pdf.py", 
line 11, in __bootstrap
    
rl_exec(marshal.loads(zlib.decompress(asciiBase85Decode(m.__code__))),c.__dict__)
  File "rlextra-3.5.61/src/rlextra/rml2pdf/rml2pdf.py", line 7075, in 
<module>
  File "rlextra-3.5.61/src/rlextra/rml2pdf/rml2pdf.py", line 7063, in main
  File "rlextra-3.5.61/src/rlextra/rml2pdf/rml2pdf.py", line 6844, in go
  File 
"D:\ReportLab\.venv\lib\site-packages\reportlab\platypus\doctemplate.py", 
line 1077, in build
    self.clean_hanging()
  File 
"D:\ReportLab\.venv\lib\site-packages\reportlab\platypus\doctemplate.py", 
line 589, in clean_hanging
    self.handle_flowable(self._hanging)
  File 
"D:\ReportLab\.venv\lib\site-packages\reportlab\platypus\doctemplate.py", 
line 923, in handle_flowable
    f.apply(self)
  File 
"D:\ReportLab\.venv\lib\site-packages\reportlab\platypus\doctemplate.py", 
line 165, in apply
    getattr(doc,arn)(*args)
  File 
"D:\ReportLab\.venv\lib\site-packages\reportlab\platypus\doctemplate.py", 
line 618, in handle_pageBegin
    self.pageTemplate.onPage(self.canv,self)
  File "rlextra-3.5.61/src/rlextra/rml2pdf/rml2pdf.py", line 1432, in 
__call__
  File "rlextra-3.5.61/src/rlextra/rml2pdf/rml2pdf.py", line 1992, in 
__call__
  File "rlextra-3.5.61/src/rlextra/pageCatcher/pageCatcher.py", line 1788, 
in restoreForms
  File "rlextra-3.5.61/src/rlextra/pageCatcher/pageCatcher.py", line 1800, 
in restoreFormsInMemory
AttributeError: Can't get attribute 'NPDFString' on <module '__main__' from 
'D:\\ReportLab\\.venv\\Lib\\site-packages\\rlextra\\rml2pdf\\rml2pdf.py'>

The tutorials seem to work fine, though I couldn't find one using 
PageCatcher. Any insight would be appreciated.

Thanks,

Damien

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20210303/dd694d05/attachment.html>


More information about the reportlab-users mailing list