Python Forum
Trying to sort a MYSQL Database
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to sort a MYSQL Database
#11
Here are all the information i've found that could be interesting:


Spyder Version: 2.3.8
Python Version: 2.7.14+
Qt Versions: 4.8.7, PyQt4 (API v2) 4.11.4 on Linux
Reply
#12
I gave up on python 2.7 several years ago. It does not handle unicode well.
Python 2.7's life will be over in less than 2 tears, current version is 3.7, python 3 has been available for 10 years. Time to upgrade?
Reply
#13
Yes maybe! That's actually a school project they basicly allowed me to use any programm i wanted so I've tried with 2.7 that i've learned 3 years ago
Reply
#14
Hello! I've upgraded to python 3.5 and I have another problem comming..

Here is the part of the program that fails:

with open('evEnfant.csv', newline='', encoding="utf-8") as csvfile:
    csv_data = csv.reader(csvfile)
    for row in csv_data:
        cursor.execute("""INSERT INTO Citela.Donnee(idDomaine,id,nom,adresse,CP,ville,details,organisme_gest,organisme_gest_associe,tel,web,mail,date_d,horaire,photo,date_f,handicap) VALUES (34, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",(row[0],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9],row[10],row[11],row[12],row[13],row[14],row[15],row[16]))
    db.commit()
print('evEnfant importé')
And here is the return:

pymysql.err.InternalError: (1366, "Incorrect string value: '\\xCC\\x81 de ...' for column 'details' at row 1")
And here is the 'details' it can't store:

"Déambulation dans le cadre des Jeudis - jeux de rue au Jardin Vert. Le sentier magique est un parcours composé de trois spectacles de courte durée.



Alice Rosset

Depuis des années, Alice Rosset œuvre pour que le grand répertoire pour piano existe aussi en dehors des salles de concert traditionnelles. Diplômée du Conservatoire Royal de Bruxelles et des Conservatoires français, elle offre une occasion de faire entendre un répertoire classique de choix grâce à son piano voyageur, aux publics les plus variés, d’une manière à la fois insolite et conviviale.



Daniel Crumb

Truculent poète et diseur, Daniel Crumb tissera de ses mots le fil rouge du sentier magique. Il nous dira des poèmes, textes ou contes de son choix (Artaud, Villiers de l’Isle-Adam, Maupassant…). Sa présence et sa voix cultiveront le lien entre les artistes, leurs oeuvres et leurs musiques.



Duo Kei Mc Gregor

En toute complicité́, Kei, le trompettiste et son accompagnateur, nous feront découvrir les musiques d’Afrique du Sud : Rythme, danse, joie et bonne humeur seront au rendez-vous.



Durée : 1h30. A voir en famille, à partir de 7 ans. Gratuit – Ouvert à tous."

I've tried lots of things to manipulate the utf-8 but i always get this error..

Thank you in advance! :)

Ok, i've found something really strange

It's the word "composé" that has a problem.

the character "é" is actually composed with "e" and "́ " and it is creating some kind of errors.
Reply
#15
In your MySQL table definition, are you using utf8 or utf8mb4?
Feel like you're not getting the answers you want? Checkout the help/rules for things like what to include/not include in a post, how to use code tags, how to ask smart questions, and more.

Pro-tip - there's an inverse correlation between the number of lines of code posted and my enthusiasm for helping with a question :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SaltStack: MySQL returner save less data into Database table columns xtc14 2 238 Jul-02-2021, 02:19 PM
Last Post: xtc14
  Problem updating value in MySQL database dangermaus33 1 367 Nov-24-2020, 08:32 PM
Last Post: dangermaus33
  chatterbot utf-8 errors with mysql database isolatedastronaut 0 413 Nov-08-2020, 06:54 AM
Last Post: isolatedastronaut
  MYSQL how to assign a table for each user in my username table database? YoshikageKira 1 1,226 Dec-26-2019, 05:57 AM
Last Post: buran
  How to return value from a stored procedure of a MySQL database? UtiliseIT 0 968 Jul-22-2019, 10:14 AM
Last Post: UtiliseIT
  Need help saving data into MySQL database reezalaq 0 1,211 Jun-03-2018, 07:50 PM
Last Post: reezalaq
  Python 3 MySQL database insert error georgian2all 7 5,136 Aug-01-2017, 06:37 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020