Instapy: 'ascii' codec can't encode character u'\u270a'

Created on 19 Apr 2017  路  8Comments  路  Source: timgrossmann/InstaPy

Seems like something is wrong with the emoji encoding:

print('--> Commented: {}'.format(rand_comment))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u270a' in position 31: ordinal not in range(128)

(I'm on the latest version, scripts doesn't work with any emoji which previously worked)

Most helpful comment

Still on the last revision of string documentation, not version related since there's no unicode flag or prefix on code and 3.5+ still support string literal prefixes.
Just an lack of testing before going live.

https://www.python.org/dev/peps/pep-0414/

@tibor could you confirm that the fix proposed on #161 fixes this issue? I'm testing in some droplets and doesn't seems to be any problem with emoji output.

All 8 comments

Can't reproduce, maybe it's not OS locale related, since the code now uses string.format?
Check your system locale and give us a feedback.

screen shot 2017-04-19 at 14 21 24

Tested it on OSx and seems to work, but on linux it doesn't.
Maybe another thing that goes live without testing, clearly is missing 'u' before the string on output.

Check https://github.com/timgrossmann/InstaPy/pull/161

Can't confirm this working on Mac as well.

For future issues: which information should be at least included in a issue (python version, version number, OS, anything else?)?

Maybe we should add this information to README.md as well to make bugtracking easier.

It's not python version related, maybe console output related (since OSx terminal is kinda of relaxed with this), maybe just OS is relevant.

Seems to be fixed on #161, will track another part of code that need this.

Might be python version related since one of the major 2to3 differences is how strings and unicodes are treated.

We should create a template to help people opening issues.

I'm using Python 2.7.10 here as well.

Still on the last revision of string documentation, not version related since there's no unicode flag or prefix on code and 3.5+ still support string literal prefixes.
Just an lack of testing before going live.

https://www.python.org/dev/peps/pep-0414/

@tibor could you confirm that the fix proposed on #161 fixes this issue? I'm testing in some droplets and doesn't seems to be any problem with emoji output.

Works for me, Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

n0sw34r picture n0sw34r  路  3Comments

Naramsim picture Naramsim  路  3Comments

seuraltimez picture seuraltimez  路  3Comments

CodeMaster1 picture CodeMaster1  路  3Comments

neomh picture neomh  路  3Comments