Skip to content

Extracting css contents from a local file produces error #25

@rushiagr

Description

@rushiagr

When I tried to parse an HTML which has a local css file, it generated this error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pynliner/__init__.py", line 112, in run
    self._get_styles()
  File "/usr/local/lib/python2.7/dist-packages/pynliner/__init__.py", line 141, in _get_styles
    self._get_external_styles()
  File "/usr/local/lib/python2.7/dist-packages/pynliner/__init__.py", line 164, in _get_external_styles
    url = self.relative_url + url
AttributeError: 'Pynliner' object has no attribute 'relative_url'

Looks like the variable 'relative_url' is not defined when a call from function other than from_url() is made. To be more clear, when one tries to do a Pynliner().from_string(html_string).with_cssString(css_string).run() where the html_string already contains a 'link' to a local stylesheet, it generates this error.

For starters, it might be confusing to see this error. A newbie, in the absence of guiding documentation, might want to pass the stringified css file to the stringified html file, where the html file already contained a link to that css file locally

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions