I'm getting this error. I already tried everything - would be great if someone can help me.
class getdata_hauptfach:
def __init__(self):
self.Schulaufgabe_Hauptfach = 0.0
self.EX1_Hauptfach = 0.0
self.EX2_Hauptfach = 0.0
self.Muendliche_Note_Hauptfach = 0.0
self.Kurzarbeit_Hauptfach = 0.0
def getSA_H(self):
self.Schulaufgabe_Hauptfach = float(input("Schulaufgabe im Hauptfach:"))
def getEX1_H(self):
self.EX1_Hauptfach = float(input("Erste Ex im Hauptfach:"))
def getEX2_H(self):
self.EX2_Hauptfach = float(input("Zweite Ex im Hauptfach:"))
def getM_H(self):
self.Muendliche_Note_Hauptfach = float(input("Mündliche Note im Hauptfach:"))
def getK_H(self):
self.Kurzarbeit_Hauptfach = float(input("Kurzarbeit im Hauptfach:"))
def getData_H(self):
count_H = 0
while count_H <= 5:
count_H = count_H + 1
Notenart_H = input('Welche Note möchtest du für das Hauptfach eintragen?')
if Notenart_H == 'Schulaufgabe':
self.getSA_H()
elif Notenart_H == 'Erste Ex':
self.getEX1_H()
elif Notenart_H == 'Zweite Ex':
self.getEX2_H()
elif Notenart_H == 'Mündliche Note':
self.getM_H()
elif Notenart_H == 'Kurzarbeit':
self.getK_H()
import _sqlite3
from GETDATA_von_Fächer import getdata_hauptfach
from GETDATA_von_Fächer import getdata_nebenfach
conn = _sqlite3.connect('Notenberechnung.sqlite')
cur = conn.cursor()
class Halbjahre:
def __init__(self, Halbjahr):
self.Halbjahr = Halbjahr
def Abfrage(self):
self.Halbjahr = input('Welches Halbjahr?')
self.Fachart = input('Hauptfach oder Nebenfach?')
self.Fachname = input('Welches Fach?')
def Speichern_in_Datenbanken(self):
if self.Halbjahr == '1':
if self.Fachart == 'Hauptfach':
getdata_hauptfach.getData_H(self.Halbjahr)
elif self.Fachart == 'Nebenfach':
getdata_nebenfach()
cur.execute()
elif self.Halbjahr == 2:
if self.Fachart == 'Hauptfach':
getdata_hauptfach()
cur.execute()
elif self.Fachart == 'Nebenfach':
getdata_nebenfach()
cur.execute()
def Test_finish(self):
self.Abfrage()
self.Speichern_in_Datenbanken()
test_Halbjahre = Halbjahre(1)
print(test_Halbjahre.Test_finish())
conn.close()
Hopefully someone can help. My friends and me don`t understand why its not working.
The error message is:
Traceback (most recent call last):
File "/Users/user/github/Jahresnote/Erste_Abfrage.py", line 59, in <module>
print(test_Halbjahre.Test_finish())
File "/Users/user/github/Jahresnote/Erste_Abfrage.py", line 56, in Test_finish
self.Speichern_in_Datenbanken()
File "/Users/user/github/Jahresnote/Erste_Abfrage.py", line 22, in Speichern_in_Datenbanken
getdata_hauptfach.getData_H(self.Halbjahr)
File "/Users/user/github/Jahresnote/GETDATA_von_Fächer.py", line 31, in getData_H
self.getSA_H()
AttributeError: 'str' object has no attribute 'getSA_H'