Commenting without diamond question mark.
Every comment has a question mark in a diamond. ๏ฟฝ
import sys
import os
from instapy import InstaPy
use_firefox=True
session = InstaPy(username='username', password='password', nogui=True, headless_browser=True, use_firefox=True, page_delay=25)
session.login()
session.set_do_comment(enabled=True, percentage=25)
session.set_comments([u'Text1! ๐๐ป',u'Text2 ๐ฅ',u'๐๐๐',u'๐๐',u'๐๐',u'๐ฅ๐ฅ๐๐',u'๐ฅ๐๐'])
session.set_do_follow(enabled=True, percentage=100, times=3)
session.set_ignore_users(['username'])
session.set_dont_like(['bla', 'bla2', 'bla3', 'bla4', 'bla5'])
session.like_by_tags(['#tag1','#tag2','#tag3','#tag4'], amount=30)
session.unfollow_users(amount=500, onlyInstapyFollowed = True, onlyInstapyMethod = 'FIFO', sleep_delay=600)
session.end()
Running environment:
Raspberry Pi3 (Jessie Lite)
Python 3.4.3
Configfile UTF-8-BOM with UNIX LF
same here, input > ([u' :punch: ', u' ๐ฏ ', u' :bomb: :bomb: :bomb: '])
same result ๐ฌ๏ฟฝ with or without space
i had previous problems with file encoding iso-8859-15 by defaut maybe the editor
i try with session.set_comments([u':fire: ', u'\u2764']) with unicode limited to 4 but still got this at the end of each comment../
๏ฟฝ
Up !
After another try, the ๏ฟฝ symbol appears also at the end of each comment in simple text without any emoji..
If anyone have an idea where to search to fix this problem..
No news regarding this?
Do the others have not such a problem?
@Venni27 fixed yead thx to @uluQulu
in comment_util.py
find and replace
rand_comment = (choice(comments).format(username))
with
rand_comment = (choice(comments).format(username)).encode('utf-8')
it works for me
Thanks for he hint. Will try that tomorrow evening.
Sadly for me it is not working.
I changed line 38 to this:
rand_comment = (choice(comments).format(username)).encode('utf-8')
But that shows the error:
File "/opt/InstaPy/instapy/comment_util.py", line 66, in comment_image
logger.info("--> Commented: {}".format(rand_comment.encode('utf-8')))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 0: ordinal not in range(128)
@Venni27
You've encoded rand_comment as @keusta said, but in other place in the same function, it is being encoded again which is making the problem
logger.info("--> Commented: {}".format(rand_comment.encode('utf-8')))
Encode it in either one place, since you will encode it in line 38 (_to prevent that symbol from appearing_), the line above should be
logger.info("--> Commented: {}".format(rand_comment))
Great hint.
Its now working again!
Thank you!!!
Most helpful comment
@Venni27
You've encoded
rand_commentas @keusta said, but in other place in the same function, it is being encoded again which is making the problemEncode it in either one place, since you will encode it in line 38 (_to prevent that symbol from appearing_), the line above should be