Giter VIP home page Giter VIP logo

Comments (3)

rsgalloway avatar rsgalloway commented on August 25, 2024

I think it only prints the exception instead of raising it because it still returns the original text. Of course that could be changed if that's bad behavior.

I've pushed a potential fix for this to the "issue-6" branch, try it out let me know.

from instapaper.

alexwlchan avatar alexwlchan commented on August 25, 2024

Hmm. If I run my example program on Python 3, I get a different error now:

$ python demo.py
Traceback (most recent call last):
  File "/Users/alexwlchan/repos/instapaper/instapaper.py", line 113, in dehtml
    text = str(text, 'UTF-8')
TypeError: decoding str is not supported

I think the correct behaviour here is to pass through text unmodified – i.e., the patch should be

if sys.version_info < (3, 0):
    text = text.decode('utf-8')

In Python 2, text is a bytestring, so we need to decode it to Unicode before passing it up the stack. But Python 3 is dealing with Unicode strings natively, so it’s already been decoded for us.

from instapaper.

Barabazs avatar Barabazs commented on August 25, 2024

I confirm that the fix from @alexwlchan works as expected. Please see PR #8 for an updated version.

from instapaper.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.