What exactly do you mean by “will not compile”? Sounds like a Python 2 vs. 3 problem. `exec code in scope` is Python 2-specific syntax. `exec(code in scope)` is meaningless, because `code in scope` is a boolean expression that will always evaluate to `False` in this context.