Giter Site home page Giter Site logo

Comments (4)

cjhutto avatar cjhutto commented on July 21, 2024 16

We migrated to Python 3 a little while ago, so there may be backwards compatibility issues with Python 2. For your issue -- in Python 2, the open() function takes no encoding argument (the third argument is the buffering option instead).

The fix is to add the following line near the top of the vaderSentiment.py file:
from io import open

If you are able to make this work, let me know, and I'll update the master branch so that others will benefit from this backwards compatibility hack.

from vadersentiment.

zHaytam avatar zHaytam commented on July 21, 2024 10

Hello, thank you for the fast reply.

Adding from io import open seems to fix the issue (tested on 2.7.12 and 3.6).
I ran mine using f.read().decode('UTF-8') because I didn't see your message in time, but your solution is better since it handles both versions.

Thank you!

from vadersentiment.

rxng avatar rxng commented on July 21, 2024

@cjhutto I've added that but it still comes up with this:

File "/usr/local/lib/python2.7/dist-packages/vaderSentiment/vaderSentiment.py", line 212, in init
lexicon_full_filepath = os.path.join(os.path.dirname(this_module_file_path), lexicon_file)
TypeError: 'encoding' is an invalid keyword argument for this function

from vadersentiment.

christianoruge avatar christianoruge commented on July 21, 2024

You saved my day! Including the line in my script did it! Thanks 👍

from vadersentiment.

Related Issues (20)

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.