Giter Site home page Giter Site logo

archive-tweets's People

Contributors

drdrang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

archive-tweets's Issues

strftime's %B, umlauts & encode('utf8')

The default datefmt = '%B %-d, %Y at %-I:%M %p' don't work with a german localized dates. The month may contains a umlaut and then the line '\n'.join(lines).encode('utf8') fails with a UnicodeDecodeError.

What happened: The string with the date is automatically decoded with the default codec (ASCII) but does not correctly decode the ä. When it later tries to encode the ascii string to utf8 the error is thrown.
You find a discussion about this here: http://bugs.python.org/issue5398

Explicitly decoding the date like this ts.strftime(datefmt).decode('utf8') solves this issue for me.

Ps: Is the minus in %-d and %-I on purpose and if yes, what's the effect of it? Don't know this syntax and also seems to not work on my machine.

Fixes for Python 3

I ran into:

  File "archive-tweets.py", line 46, in <module>
    ts.strftime(datefmt).decode('utf8'),
AttributeError: 'str' object has no attribute 'decode'

As an error when using Python 3. Changing line 44 to ts.strftime(datefmt), and changing line 48 to f.write('\n'.join(lines)) fixed the issue.

I'm happy to submit this as a pull request if the project is put under an open source license (I like the MIT license but that's just my preference).

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.