Dazu möchte ich ein kleines Programm schreiben, in dem ich einen (Spannungs-)wert wähle (DAC6_offset). Dieser Wert soll in ein Modul übergeben werden. Dieses Modul stellt den Wandler dann auf die gewählte Spannung.
Dann soll das Programm von vorne starten, so dass ich sofort eine neue Spannung wählen kann, also eine Schleife. Leider funktioniert es nicht. Vielleicht gibt es hier jemanden, der mir kurz sagen kann, was falsch ist. Danke im Voraus!
Code: Alles auswählen
#!/usr/bin/env python
print 'Voltage Test'
while True:
global DAC6_offset #
DAC6_offset = int(raw_input('Choose Voltage [mV]: '))
if DAC6_offset == 99999: # Programm beenden, wenn 99999 gewählt wird
break
else:
import config # Modul zum Steuern des Wanlders
config.create_main_window()
print 'Byby!'
1. Ich muss die Spannung zweimal wählen,
2. Dann kommt eine Fehlermeldung:
AttributeError: 'module' object has no attribute 'create_main_window'
Die gesamte Ausgabe lautet:
Voltage Test of DSP-Board
Choose Voltage [mV]: 123
Voltage Test of DSP-Board
Choose Voltage [mV]: 123
Traceback (most recent call last):
File "./vtest.py", line 23, in ?
import config
File "/root/python/config.py", line 49, in ?
from vtest import DAC6_offset
File "/root/python/vtest.py", line 24, in ?
config.create_main_window()
AttributeError: 'module' object has no attribute 'create_main_window'
Was ist da faul?