[Tutor] Mysterious Qualifier!

Fred Allen fallen@leveltwo.com
Fri, 15 Feb 2002 13:29:24 -0800


Dear Tutors:

Despite reviewing the documentation, I seem unable to find how to correct
the syntax error presented beneath the following code block. I'm using 2.2.

def lsdoc(modu):
	exec 'reload ' + modu
	md = eval(modu + ".__doc__")
	print 'Module ' + str(modu) + "'s Document String:", md
	lscdocs(modu)

	def lscdocs(modu):

		…MORE CODE…


“SyntaxError: unqualified exec is not allowed in function 'lsdoc' it
contains a nested function with free variables (lsmoddocs.py, line 8)”


I see I should qualify the 'exec' command, or so it seems, but the only
means I know of qualifying anything is with the dot operator.  I fail to see
how, what, and with what, to carry out this error's implicit corrective.  If
you can give me a suggestion, I'd be most grateful.  I am,

Respectfully,

Fred Allen