A simple print function
def TODO(message):
print(type(message))
print(u'\n~*~ TODO ~*~ \n %s\n ~*~\n' % message)
called like this
TODO(u'api servisleri için input check decorator gerekiyor')
results in this error
<type 'unicode'>
Traceback (most recent call last):
File "/srv/www/proj/__init__.py", line 38, in <module>
TODO(u'api servisleri için input check decorator gerekiyor')
File "/srv/www/proj/helpers/utils.py", line 33, in TODO
print(u'\n~*~ TODO ~*~ \n %s\n ~*~\n' % message)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in position 32: ordinal not in range(128)
But it works in ipython console
In [10]: TODO(u'api servisleri için input check decorator gerekiyor')
<type 'unicode'>
~*~ TODO ~*~
api servisleri için input check decorator gerekiyor
~*~
This works with python 2.7.12 but fails somehow with 2.7.9.
What is it that am i doing wrong here?
Edit: function fails when called in a flask application, works in python console.