Problème d'appel de fonctions Python dans une requête SQL
Bonsoir,
J'ai une erreur sur ce script avec le message
Citation:
Traceback (most recent call last):
File "D:\Utilisateurs\Genius\Documents\Programmation\database_parser_IL2_Great_Battles.py", line 521, in <module>
SET bombs_kg = payload_bombs(Planes.aircraft_name, Planes.payload_id);''')
sqlite3.OperationalError: no such function: payload_bombs
Code:
1 2 3
|
cur.execute('''UPDATE Planes
SET bombs_kg = payload_bombs(Planes.aircraft_name, Planes.payload_id);''') |
pourtant j'importe bien toutes mes fonctions au préalable:
Code:
from aircraft_payloads import *
Voici un extrait de mes fonctions dans le fichier aircraft_payloads:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| def payload_name (aircraft_name, payload_id):
"""Extraction of the payload name"""
try:
b = aircraft_payload[aircraft_name]
except:
print("unknow plane")
else:
try:
c = (b[payload_id])
except:
print("unknow payload")
else:
print (c[1])
return (c[1])
def payload_bombs (aircraft_name, payload_id):
"""Extraction of the bombs Weight"""
try:
b = aircraft_payload[aircraft_name]
except:
print("unknow plane")
else:
try:
c = (b[payload_id])
except:
print("unknow payload")
else:
print (c[2])
return (c[2])
def payload_rockets (aircraft_name, payload_id):
"""Extraction of the rockets Weight"""
try:
b = aircraft_payload[aircraft_name]
except:
print("unknow plane")
else:
try:
c = (b[payload_id])
except:
print("unknow payload")
else:
print (c[3])
return (c[3]) |
Auriez-vous un conseil ?
Merci d'avance