Is exec() also not used in python 2.7.1 anymore?

Wong Wah Meng-R32813 r32813 at freescale.com
Tue Oct 4 03:51:06 EDT 2011


In migrating my application from python 1.5.2 to 2.7.1, one of my modules breaks when I import it. Here is the line where it breaks. Can I have a quick check if this built-in function still supported in python 2.7.1 and if so, what ought to be changed here? Thanks in advance for replying.

  exec('def %s(self, *args, **kw): pass'%methodStrName)
SyntaxError: unqualified exec is not allowed in function '_exposeMethods' it contains a nested function with free variables

Regards,
Wah Meng

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20111004/1dacfa24/attachment.html>


More information about the Python-list mailing list