pynliner
pynliner copied to clipboard
Can't use pynliner - some errors
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.
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
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.
Why this patch: self._get_url(url).decode('utf-8') Is not applied to source code ?
@aktywnitu: does this PR fix your issue? https://github.com/rennat/pynliner/pull/55
@rennat We can't migrate to Python 3 because of this error. Is pynliner unmaintained?
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!
Hey @rennat we need PR #55 merged to have Python 3 compatibility, are you planning to merge it soon? Thanks @utapyngo
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?
you can use any online cssinliner, if you wan't to use this for email. there are lot of option, just google it.