pynliner icon indicating copy to clipboard operation
pynliner copied to clipboard

Can't use pynliner - some errors

Open aktywnitu opened this issue 8 years ago • 9 comments

I have some code:

from pynliner import Pynliner
p=Pynliner().from_url('https://saturn.pl/')
p.run()

In Python 3:

"venv3/lib/python3.5/site-packages/pynliner/__init__.py", line 179, in _get_external_styles
    self.style_string += self._get_url(url)
TypeError: Can't convert 'bytes' object to str implicitly

In Python 2:

"venv2/local/lib/python2.7/site-packages/pynliner/__init__.py", line 179, in _get_external_styles
    self.style_string += self._get_url(url)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)

>>> pynliner.__version__
'0.7.1'

Please help me achieve result.

aktywnitu avatar Jun 12 '16 12:06 aktywnitu

Some errors corrected: self.style_string += self._get_url(url).decode('utf-8')

, but still new:

File "venv3/lib/python3.5/site-packages/pynliner/soupselect.py", line 110, in select
    raise Exception("No match was found. We're done or something is broken")
Exception: No match was found. We're done or something is broken

aktywnitu avatar Jun 13 '16 03:06 aktywnitu

ok, i see that pynliner not support some css selectors (for example "audio:not([controls])". Why pylinter don't continue after comming with unrecognized token - it raises exception, which make this library useless for many cases.

aktywnitu avatar Jun 13 '16 04:06 aktywnitu

Why this patch: self._get_url(url).decode('utf-8') Is not applied to source code ?

estevopaz avatar Jul 29 '16 14:07 estevopaz

@aktywnitu: does this PR fix your issue? https://github.com/rennat/pynliner/pull/55

utapyngo avatar Dec 01 '16 03:12 utapyngo

@rennat We can't migrate to Python 3 because of this error. Is pynliner unmaintained?

utapyngo avatar Dec 08 '16 11:12 utapyngo

Howdy @utapyngo , I do maintain pynliner but I don't actively use it on any projects anymore. This means I only get around to merging in PRs and making releases a few times a year. PR #55 looks fine. I hope to get to this before the new year. Thanks for being involved and making a pull request!

rennat avatar Dec 08 '16 19:12 rennat

Hey @rennat we need PR #55 merged to have Python 3 compatibility, are you planning to merge it soon? Thanks @utapyngo

emiviada avatar Jan 10 '17 18:01 emiviada

PR #55 is merged and released in 0.8.0 @utapyngo @emiviada

@aktywnitu can you confirm if your issue is still happening on version 0.8.0?

rennat avatar Jan 10 '17 19:01 rennat

you can use any online cssinliner, if you wan't to use this for email. there are lot of option, just google it.

vkrytpo avatar Nov 05 '19 12:11 vkrytpo