Giter VIP home page Giter VIP logo

tweetsforever's People

Contributors

damonregan avatar

Stargazers

 avatar

Watchers

 avatar  avatar

tweetsforever's Issues

UnicodeEncodeError: 'charmap' codec can't encode character u'\u201c' in position 12: character maps to <undefined>

In tweets.py...

It appears that if a tweet text contains a unicode character (in this case, u'\u201c') a UnicodeEncodeError is generated.

Traceback (most recent call last):

 File "tweets.py", line 25, in <module>
      print status.text

 File "c:\development\envs\tfe\lib\encodings\cp437.py", line 12, in encode
      return codecs.charmap_encode(input,errors,encoding_map)

 UnicodeEncodeError: 'charmap' codec can't encode character u'\u201c' in position 12: character maps to <undefined>

AttributeError: type object 'EDAMErrorCode' has no attribute '_VALUES_TO_NAMES'

In the notes.py...

The EDAMErrorCode enum wasn't fetching the string value of the enum for the error code text:

 errorText = Errors.EDAMErrorCode._VALUES_TO_NAMES[errorCode]
 AttributeError: type object 'EDAMErrorCode' has no attribute '_VALUES_TO_NAMES'

I modified the EDAMErrorCode class to include enum tostring and fromstring methods:

 class EDAMErrorCode(object):
   UNKNOWN = 1
   BAD_DATA_FORMAT = 2
   PERMISSION_DENIED = 3
   INTERNAL_ERROR = 4
   DATA_REQUIRED = 5
   LIMIT_REACHED = 6
   QUOTA_REACHED = 7
   INVALID_AUTH = 8
   AUTH_EXPIRED = 9
   DATA_CONFLICT = 10
   ENML_VALIDATION = 11
   SHARD_UNAVAILABLE = 12

   @classmethod
   def tostring(cls, val):
     for k,v in vars(cls).iteritems():
       if v == val:
         return k

   @classmethod
   def fromstring(cls, str):
     return getattr(cls, str.upper(), None)

and then then modified the errorText statement to be:

 errorText = Errors.EDAMErrorCode.tostring(errorCode)

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.