Re: SyntaxError: unqualified exec is not allowed in ... ?

From: j vickroy (jim.vickroy_at_noaa.gov)
Date: 10/08/03


Date: Wed, 8 Oct 2003 11:10:18 -0600

OK-- never fails -- puzzle over something for a long period of time -- post
message to group -- see cause of error soon after posting.

There is a lambda expression further down the line in the function where the
syntax error is raised.

Sorry for the needless posting.

"j vickroy" <jim.vickroy@noaa.gov> wrote in message
news:bm1doh$if7$1@boulder.noaa.gov...
> Could someone help me understand the following Python 2.3 error message:
>
> SyntaxError: unqualified exec is not allowed in function 'load' it
contains
> a nested function with free variables
>
> in the following context:
>
> class Spam(object): pass
>
> class Spammer(object):
> ...
> def load(self):
> ...
> exec 'o = %s()' % Spam.__name__
> ...
>
>
> Thanks.
>
> P.S.
> I would provide a simple script demonstrating the problem, but, so far, I
> have not been able to reproduce the error in a simple context.
>
>



Relevant Pages


Loading