Python 2.7: name is not defined (when in fact it is)

Hi,
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 = ""
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>
    habla()
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.
Regards,
Sukil



_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Sukil via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sukil via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : dhruv via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sukil via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : dhruv via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : dhruv via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sukil via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sukil via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : stewie via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sukil via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Sukil via Audiogames-reflector

Reply via email to