I'm trying to improve Tyler Spivey's BNS emulator. Those who follow the Talking Dosbox mailing list will know that I'm trying to make it compatible with Habla, a Spanish screen reader. This screen reader, instead of following its messages with a carriage return, expect the bns to process them after some time (300 ms aprox.). So here's my problem:
I'm using argparse (from another module) to let the user, ammong other things, to tell the program whether it should be run in "habla" mode:
emu.py (main script):
if cmd.args.habla == True: habla()
cmd.py (the argument parser itself):
parser.add_argument("--habla", help = "If specified, makes the emulator compatible with Habla", action = "store_true") args = parser.parse_args()
Then, of course, I define a function with no arguments called habla, which controls the timer, and calls other functions:
def habla(): synth.speak("Modo habla activado") starttime = time.clock() while True: if time.clock()-starttime >= .300: process(lst) starttime = time.clock()
Regardless of that, when I try to run in habla mode, I get this traceback:
Traceback (most recent call last):
File "emu.py", line 9, in <module>
NameError: name 'habla' is not defined
I also get an "exception in thread Thread-1", but none of the files there is directly modified by me.
Any help would be appreciated.