Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findSpanStyle not implemented in this parser #28

Open
venugopal24 opened this issue Apr 15, 2024 · 1 comment
Open

findSpanStyle not implemented in this parser #28

venugopal24 opened this issue Apr 15, 2024 · 1 comment

Comments

@venugopal24
Copy link

Hello,Below is my question on reportlab

When i run the below code in py3 environment with reportlab version 4.0.0

from reportlab.platypus import Paragraph
from reportlab.lib.styles import getSampleStyleSheet

sample_txt = '<p><span style=\'font-family: Arial; background-color: #ffffff;\'>Sample Content</span></p>'
styles = getSampleStyleSheet()
para_text = Paragraph(sample_txt, styles['Normal'])

Getting below error,

Traceback (most recent call last):
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/platypus/paraparser.py", line 3215, in parse
    self.feed(text)
  File "/home/kvenugopal/.pyenv/versions/3.9.7/lib/python3.9/html/parser.py", line 110, in feed
    self.goahead(0)
  File "/home/kvenugopal/.pyenv/versions/3.9.7/lib/python3.9/html/parser.py", line 170, in goahead
    k = self.parse_starttag(i)
  File "/home/kvenugopal/.pyenv/versions/3.9.7/lib/python3.9/html/parser.py", line 344, in parse_starttag
    self.handle_starttag(tag, attrs)
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/platypus/paraparser.py", line 3238, in handle_starttag
    start(attrs or {})
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/platypus/paraparser.py", line 2832, in start_span
    style = self.findSpanStyle(A.pop('style'))
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/platypus/paraparser.py", line 3205, in findSpanStyle
    raise ValueError('findSpanStyle not implemented in this parser')
ValueError: findSpanStyle not implemented in this parser

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kvenugopal/venudocs/pypdfissue/reportlabone.py", line 6, in <module>
    para_text = Paragraph(sample_txt, styles['Normal'])
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/platypus/paragraph.py", line 1800, in __init__
    self._setup(text, style, bulletText or getattr(style,'bulletText',None), frags, cleanBlockQuotedText)
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/platypus/paragraph.py", line 1821, in _setup
    style, frags, bulletTextFrags = _parser.parse(text,style)
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/platypus/paraparser.py", line 3217, in parse
    annotateException('\nparagraph text %s caused exception' % ascii(text))
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/lib/utils.py", line 1176, in annotateException
    rl_reraise(t,t(sep.join((_ for _ in (msg,str(v),postMsg) if _))),b)
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/lib/utils.py", line 138, in rl_reraise
    raise v.with_traceback(b)
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/platypus/paraparser.py", line 3215, in parse
    self.feed(text)
  File "/home/kvenugopal/.pyenv/versions/3.9.7/lib/python3.9/html/parser.py", line 110, in feed
    self.goahead(0)
  File "/home/kvenugopal/.pyenv/versions/3.9.7/lib/python3.9/html/parser.py", line 170, in goahead
    k = self.parse_starttag(i)
  File "/home/kvenugopal/.pyenv/versions/3.9.7/lib/python3.9/html/parser.py", line 344, in parse_starttag
    self.handle_starttag(tag, attrs)
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/platypus/paraparser.py", line 3238, in handle_starttag
    start(attrs or {})
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/platypus/paraparser.py", line 2832, in start_span
    style = self.findSpanStyle(A.pop('style'))
  File "/home/kvenugopal/venudocs/pypdfissue/reportlab/platypus/paraparser.py", line 3205, in findSpanStyle
    raise ValueError('findSpanStyle not implemented in this parser')
ValueError: 
paragraph text "<para><p><span style='font-family: Arial; background-color: #ffffff;'>Sample Content</span></p></para>" caused exception findSpanStyle not implemented in this parser

Any fix for the above issue?

@venugopal24
Copy link
Author

Any updates on this. I am seeing nothing from documentation as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant