Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding error #45

Closed
ianjuma opened this issue Apr 7, 2017 · 9 comments
Closed

Encoding error #45

ianjuma opened this issue Apr 7, 2017 · 9 comments

Comments

@ianjuma
Copy link

ianjuma commented Apr 7, 2017

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 119: ordinal not in range(128) for some links

--> Image Liked!
Traceback (most recent call last):
  File "./quickstart.py", line 19, in <module>
    .like_by_tags(['#dog', '#messi', '#cr7', 'top'], amount=100) \
  File "/home/synod/AT/cronos/InstaPy/instapy/instapy.py", line 271, in like_by_tags
    print('Invalid Page: ' + str(err))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 119: ordinal not in range(128)
@vagnes
Copy link
Contributor

vagnes commented Apr 7, 2017

This is probably because of the encoding of the console you are using. To set for example Powershell to UTF-8, write the following in the console.

chcp 65001

Hope that works!

@hariom282538
Copy link

hariom282538 commented Apr 13, 2017

This is a terminal encoding issue.
Follow below mentioned steps:

  1. Open CMD(for windows)
  2. Open directory (cd InstaPy)
  3. Command: set PYTHONIOENCODING=UTF-8
  4. Execute this command every time before running python script.

Hope this works!

@tibor
Copy link
Contributor

tibor commented Apr 22, 2017

Hi @hariom282538,

when I use your solution under CentOS, Chrome crashes immediately when the script starts.
Do you know any other solution?

Kind regards

Tibor

@hariom282538
Copy link

hariom282538 commented Apr 22, 2017 via email

@tibor
Copy link
Contributor

tibor commented Apr 22, 2017

Hi,

attached you can find the screenshot:

img_0571

@hariom282538
Copy link

hariom282538 commented Apr 24, 2017 via email

@timgrossmann
Copy link
Collaborator

@tibor probably too low on RAM 😉

@hojabbr
Copy link

hojabbr commented Nov 23, 2017

Just add these lines to quickstart.py and instapy.py:

# -*- coding: UTF-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

@suchendra-h
Copy link

I tried all solutions I still get this error. I am using Pycharm. Any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants