Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > SyntaxError: unqualified exec is not allowed in ... ?

Reply
Thread Tools

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

 
 
j vickroy
Guest
Posts: n/a
 
      10-08-2003
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.


 
Reply With Quote
 
 
 
 
j vickroy
Guest
Posts: n/a
 
      10-08-2003
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" <(E-Mail Removed)> wrote in message
news:bm1doh$if7$(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why defining a constant in a method is not allowed but usingself.class.const_set is allowed? IƱaki Baz Castillo Ruby 13 05-01-2011 06:09 PM
Re: Don't understand syntax error: unqualified exec is not allowed .. Terry Reedy Python 0 10-20-2008 10:13 PM
Don't understand syntax error: unqualified exec is not allowed .. Stef Mientki Python 0 10-20-2008 08:39 PM
Backup Exec 9.1: The Backup Exec job engine system service is not responding Christian Falch Computer Support 1 06-23-2004 02:22 AM
qualified and unqualified local elements (was: My schema validation is not working?) C. M. Sperberg-McQueen XML 0 07-31-2003 01:59 AM



Advertisments