AttributeError: 'NoneType' object has no attribute 'fetchrows'
Salut,
je suis en train de realiser un petite application Pyhon avec Tkinter qui est connecter a une base de donnees MySQL.
Dans mon code j´ai cree une fonction qui selectionne les elements d´un table (ici table phone)
Code:
1 2 3 4 5 6 7 8
|
def setSelect () :
global phoneList
c = db.query("select id,name,phone from phones order by name")
phoneList = c.fetchrows()
select.delete(0,END)
for id,name,phone in phoneList :
select.insert (END, name) |
...mais cela me renvoi l´erreur suivante:
Code:
1 2 3 4 5 6 7 8
|
linux:~/Python/Tutorials # python sqlPhone.py
Traceback (most recent call last):
File "sqlPhone.py", line 85, in ?
setSelect ()
File "sqlPhone.py", line 79, in setSelect
phoneList.fetchrows(c)
AttributeError: 'NoneType' object has no attribute 'fetchrows' |
....j´ai evidement consulter la FAQ Tkinter et reessayer comme ca
Code:
1 2 3 4 5 6 7 8 9 10
|
def setSelect () :
global phoneList
c = db.query("select id,name,phone from phones order by name")
#phoneList = c.fetchrows()
phoneList = c
phoneList.fetchrows()
select.delete(0,END)
for id,name,phone in phoneList :
select.insert (END, name) |
...mais cela me renvoi toujours la meme erreur.
Pardonne mon inexperience en Python, c´est probablement une erreur toute bete...:oops: :oops: :oops:
Merci de votre aide...