[reportlab-users] Run time error with version 3.4

lizhe Xu xulz2004 at yahoo.com
Thu May 18 15:30:18 EDT 2017


I called my colleague who developed the Python code and he is using the script daily without any error. The only difference between his and mine is I'm using the newer vision of reportLab. 
Yes, the script tries to save a canvas for each loop by adding a new page. Attached two files are the results of running the script from different data sets: WithSave.pdf was generated by my colleague with the original script and old version of reportLab; WithoutSave.pdf was generated from my computer by commenting out the line 546 c.save(). 
So, I guess the implementation of the new SaveToFile may differ in the different versions. But my goal is to run the script on my computer without bothering my colleague by emailing data to him anymore. So I wonder if there is a method other than save() will do the magic for me. 
Thanks.

Lz      From: Robin Becker <robin at reportlab.com>
 To: reportlab-users <reportlab-users at lists2.reportlab.com>; lizhe Xu <xulz2004 at yahoo.com> 
Cc: Peter Cock <p.j.a.cock at googlemail.com>
 Sent: Thursday, May 18, 2017 10:36 AM
 Subject: Re: [reportlab-users] Run time error with version 3.4
  
The typo was fixed in rev 4353. You can get the latest packages from

https://www.reportlab.com/pypi

use pip install -ihttps://www.reportlab.com/pypi -U reportlab

(needs a user id and login). Alternatively just download the latest source from 
bitbucket.org.

The content of the error message should give you a hint as to what is going 
wrong. However, it is most likely you are trying to save a canvas more than once.


On 18/05/2017 14:44, Peter Cock via reportlab-users wrote:
> That in itself is a typo, RunTimeError should be RuntimeError
> which is a built in exception in Python (lower case t).
>
> However, that won't solve the underlying problem which is something
> about class instances which can only be solved once?
>
> Peter
>
> On Thu, May 18, 2017 at 2:35 PM, lizhe Xu via reportlab-users
> <reportlab-users at lists2.reportlab.com> wrote:
>> My colleague sent me a python script which he is using frequently and no
>> problem or error. I don't know which version of reportlab he uses but it's
>> not the latest verison 3.4. When I got it and run on my Mac with Python 2.7
...........
>> File "/usr/local/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py",
>> line 211, in SaveToFile
>>    raise RunTimeError("class %s instances can only be saved once" %
>> self.__class__.__name__)
>> NameError: global name 'RunTimeError' is not defined
>> [Finished in 132.485s
>>
>>
>> Please help to fix the problem. Thanks.
>>
>>
>>
>> Lz
>>
>> _______________________________________________
>> reportlab-users mailing list
>> reportlab-users at lists2.reportlab.com
>> https://pairlist2.pair.net/mailman/listinfo/reportlab-users
>>
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
> https://pairlist2.pair.net/mailman/listinfo/reportlab-users
>


-- 
Robin Becker


   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20170518/d7d078d3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WithSave.pdf
Type: application/pdf
Size: 60248 bytes
Desc: not available
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20170518/d7d078d3/attachment-0002.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WithoutSave.pdf
Type: application/pdf
Size: 13004731 bytes
Desc: not available
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20170518/d7d078d3/attachment-0003.pdf>


More information about the reportlab-users mailing list