Olá!
Ao preparar o banco de dados mySQL usando o script prepara_banco.py me deparei com uma mensagem de erro:
_mysql_exceptions.OperationalError: (1366, "Incorrect string value: '\xE7\xE3o' for column 'categoria' at row 1")
Parece que não estou conseguindo inserir string com caracteres acentuados nas tabelas. O script foi executado sem alterações.
Saída completa da execução do script e versão Python utilizada em PS.
TIA,
WB::
C:\Anaconda3\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.2\helpers\pydev\pydevconsole.py" 49357 49358
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['C:\\Dev\\Alura\\Python3\\Flask1', 'C:/Dev/Alura/Python3/Flask1'])
Python 3.6.2 |Anaconda, Inc.| (default, Sep 20 2017, 13:35:58) [MSC v.1900 32 bit (Intel)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 6.1.0
Python 3.6.2 |Anaconda, Inc.| (default, Sep 20 2017, 13:35:58) [MSC v.1900 32 bit (Intel)] on win32
C:\Anaconda3\python.exe C:/Dev/Alura/Python3/Flask1/prepara_banco.py
Conectando...
------------- Usuários: -------------
Danilo
Luan Marques
Nico
Traceback (most recent call last):
File "C:/Dev/Alura/Python3/Flask1/prepara_banco.py", line 52, in <module>
('Fire Emblem Echoes', 'Estratégia', '3DS'),
File "C:\Anaconda3\lib\site-packages\MySQLdb\cursors.py", line 281, in executemany
self._get_db().encoding)
File "C:\Anaconda3\lib\site-packages\MySQLdb\cursors.py", line 318, in _do_execute_many
rows += self.execute(sql + postfix)
File "C:\Anaconda3\lib\site-packages\MySQLdb\cursors.py", line 250, in execute
self.errorhandler(self, exc, value)
File "C:\Anaconda3\lib\site-packages\MySQLdb\connections.py", line 50, in defaulterrorhandler
raise errorvalue
File "C:\Anaconda3\lib\site-packages\MySQLdb\cursors.py", line 247, in execute
res = self._query(query)
File "C:\Anaconda3\lib\site-packages\MySQLdb\cursors.py", line 411, in _query
rowcount = self._do_query(q)
File "C:\Anaconda3\lib\site-packages\MySQLdb\cursors.py", line 374, in _do_query
db.query(q)
File "C:\Anaconda3\lib\site-packages\MySQLdb\connections.py", line 277, in query
_mysql.connection.query(self, query)
_mysql_exceptions.OperationalError: (1366, "Incorrect string value: '\\xE7\\xE3o' for column 'categoria' at row 1")
Process finished with exit code 1