[reportlab-users] Puzzling Error
Wed, 6 Nov 2002 10:30:58 +0000
In article <20021105170849.GA4507@mail.librelogiciel.com>, Jerome Alet <firstname.lastname@example.org> writes
>Alternatively pdfdoc.py could be modified in a way similar to :
> if hasattr(filename, "isupper") and callable(filename.isupper) :
> myfile = 1
> f = open(str(filename), "wb")
> else :
> myfile = 0
> f = filename
>this is untested but should work
>but there's a similar test in canvas.py in Canvas class's save()
>method so you'll have to modify it there too.
I'm going to merge the problem into canvas
"""Saves and close the PDF document in the file.
If there is current data a ShowPage is executed automatically.
After this operation the canvas must not be used further."""
if len(self._code): self.showPage()
if callable(getattr(filename, "write",None)):
myfile = 0
f = filename
filename = str(getattr(filename,'name',''))
myfile = 1
filename = str(filename)
f = open(filename, "wb")
txt = self.format()
markfilename(filename) # do platform specific file junk
if getattr(canvas,'_verbosity',None): print 'saved', filename
seems to work in 1.5.2