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

Erro em perfis com Caracteres especiais #3

Open
bragatrosco opened this issue Sep 24, 2018 · 2 comments
Open

Erro em perfis com Caracteres especiais #3

bragatrosco opened this issue Sep 24, 2018 · 2 comments

Comments

@bragatrosco
Copy link

Esta retornando erro em nomes de perfis com caracteres especiais. Caso de alguns candidatos que colocaram imagens compondo o nome. Alguma dica para contornar o problema?

@lagolucas
Copy link
Contributor

Não tinha pego esse erro quando executei, mas se for no momento que calcula o score-CAP acho que podemos escapar tratando a exceção sem perder muito do valor ali. Apesar que isso influenciaria um pouco na amostra.

Se for na @ do candidato mesmo, daí talvez precisamos fazer um replace lá no início para evitar o uso desses caracteres, melhor perder fidelidade no armazenamento do handle, que perder a conta como um todo...

@bragatrosco
Copy link
Author

[braga@localhost botometer]$ python get_followers.py
((33374761, 'cirogomes', 'Ciro Gomes', 307565, 1, 0), (51735736, 'afranioboppre', 'Afr\xc3\xa2nio 5050', 2131, 1, 0), (73745956, 'alvarodias_', 'Alvaro Dias', 349520, 1, 0), (128372940, 'Jair Bolsonaro', None, 0, 1, 0), (354095556, 'Haddad_Fernando', 'Fernando Haddad', 687187, 1, 0), (494268633, 'brunosouzasc', 'Bruno Souza - 40.030', 637, 1, 0), (762402774260875265, 'GuilhermeBoulos', 'Guilherme Boulos 50', 129985, 1, 0))
('cirogomes', 307651)
('afranioboppre', 2131)
('alvarodias_', 349529)
('Jair Bolsonaro', 1483484)
Traceback (most recent call last):
File "get_followers.py", line 50, in
update_politico(target[0], user.followers_count, user.name,user.screen_name)
File "get_followers.py", line 32, in update_politico
cursor.execute(sql)
File "/usr/lib64/python2.7/site-packages/pymysql/cursors.py", line 170, in execute
result = self._query(query)
File "/usr/lib64/python2.7/site-packages/pymysql/cursors.py", line 328, in _query
conn.query(q)
File "/usr/lib64/python2.7/site-packages/pymysql/connections.py", line 516, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/lib64/python2.7/site-packages/pymysql/connections.py", line 727, in _read_query_result
result.read()
File "/usr/lib64/python2.7/site-packages/pymysql/connections.py", line 1066, in read
first_packet = self.connection._read_packet()
File "/usr/lib64/python2.7/site-packages/pymysql/connections.py", line 683, in _read_packet
packet.check_error()
File "/usr/lib64/python2.7/site-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/usr/lib64/python2.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1366, u"Incorrect string value: '\xEF\xB8\x8F\xE2\x83\xA3...' for column 'handle' at row 1")

Aconteceu no perfil do JB, parece ser no handle. No Twitter está Jair: Bolsonaro 1ï¸�⃣7ï¸�⃣, termina com a imagem de duas teclas. Tentei trocando por outro candidato usando a imagem do número e o erro repetiu.

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

2 participants