Yes, re.sub(..., flags=) is a parameter since python 2.7

For older python, flags can be embeded, re.DOTALL becomes '(?s)':

color += re.sub('(.).',lambda m: m.group(1),line, flags=re.DOTALL)

could be replaced by:

color += re.sub('(?s)(.).',lambda m: m.group(1),line)

If this works, fpdf.py could be modified.

For more info see:

http://bugs.python.org/issue3482

Regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


On Thu, Nov 29, 2012 at 11:00 AM, Niphlod <niph...@gmail.com> wrote:
> uhm, seemed a different problem: according to
> http://docs.python.org/2/library/re.html the "flags" parameter was added
> only in python 2.7
>
>
> On Thursday, November 29, 2012 2:55:48 PM UTC+1, carlo wrote:
>>
>> Found: it seems a problem with 32 bit png files. When converted to 24 bit,
>> pdf rendering was ok. Thank you.
>>
>> Il giorno giovedì 29 novembre 2012 13:45:08 UTC+1, José Luis Redrejo
>> Rodríguez ha scritto:
>>>
>>> Hi Carlo
>>> I'm using fpdf without any problem, so I guess the reason is in some of
>>> the data you're passing to fpdf.
>>> The code of the controller would be needed to can lend you a hand.
>>>
>>> Regards
>>>
>>>
>>> 2012/11/29 carlo <syse...@gmail.com>
>>>>
>>>> No error with web2py 1.9.4.
>>>>
>>>> With 2.2.1 I got this with Python 2.5 and Python 2.6
>>>>
>>>>
>>>>
>>>> Traceback (most recent call last):
>>>>   File "C:\Python25\web2py\gluon\restricted.py", line 212, in restricted
>>>>
>>>>
>>>>     exec ccode in environment
>>>>   File
>>>> "C:/Python25/web2py/applications/Hcontrol/controllers/default.py", line
>>>> 1000, in <module>
>>>>
>>>>
>>>>   File "C:\Python25\web2py\gluon\globals.py", line 188, in <lambda>
>>>>
>>>>
>>>>     self._caller = lambda f: f()
>>>>
>>>>
>>>>   File
>>>> "C:/Python25/web2py/applications/Hcontrol/controllers/default.py", line 
>>>> 558,
>>>> in pdf_prev
>>>>
>>>>
>>>>     pdf.add_page()
>>>>   File "C:\Python25\web2py\gluon\contrib\fpdf\fpdf.py", line 284, in
>>>> add_page
>>>>
>>>>
>>>>     self.header()
>>>>   File
>>>> "C:/Python25/web2py/applications/Hcontrol/controllers/default.py", line 
>>>> 540,
>>>> in header
>>>>
>>>>
>>>>     self.image(logo,10,8,50)
>>>>
>>>>
>>>>   File "C:\Python25\web2py\gluon\contrib\fpdf\fpdf.py", line 896, in
>>>> image
>>>>
>>>>
>>>>     info=self._parsepng(name)
>>>>
>>>>
>>>>   File "C:\Python25\web2py\gluon\contrib\fpdf\fpdf.py", line 1749, in
>>>> _parsepng
>>>>
>>>>
>>>>     color += re.sub('(.{3}).',lambda m: m.group(1),line,
>>>> flags=re.DOTALL)
>>>>
>>>>
>>>> TypeError: sub() got an unexpected keyword argument 'flags'
>>>>
>>>> --
>>>>
>>>>
>>>>
>>>
>>>
> --
>
>
>

-- 



Reply via email to