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

Can't use pynliner - some errors #47

Open
aktywnitu opened this issue Jun 12, 2016 · 9 comments
Open

Can't use pynliner - some errors #47

aktywnitu opened this issue Jun 12, 2016 · 9 comments

Comments

@aktywnitu
Copy link

aktywnitu commented Jun 12, 2016

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
Copy link
Author

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
Copy link
Author

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.

@estevopaz
Copy link

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

@utapyngo
Copy link
Contributor

utapyngo commented Dec 1, 2016

@aktywnitu: does this PR fix your issue? #55

@utapyngo
Copy link
Contributor

utapyngo commented Dec 8, 2016

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

@rennat
Copy link
Owner

rennat commented Dec 8, 2016

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!

@emiviada
Copy link

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

@rennat
Copy link
Owner

rennat commented Jan 10, 2017

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?

@vkrytpo
Copy link

vkrytpo commented Nov 5, 2019

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

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

6 participants