I have this code chunk:
tables = ["Farm", "Animals",
"AnimalTypes","Users","Roles","Capabilities","Pedigrees","ChipMaker","Owner","Providers","RegistryL"]
for x in tables:
cmd = "self.cb" + x + "Read = IntVar()"
exec cmd in locals(), globals()
When the code is executed, I get the following error:
File "z.py", line 4398
exec cmd in locals(), globals()
SyntaxError: function 'showRoles' uses import * and bare exec, which are
illegal because it contains a nested function with free variables
What I am trying to do is create a set of variables based upon the table names
in the table variables. I have similar code which dynamically creates check
buttons and the associated grid. But I suspect those won't work either.
What have I got wrong?
Thanks!
Chris
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor