Comment Comment by joncatanio I get the same error with your example, but this works fine (Python 3.6.4): exec("a = 1") print(a) This will print "1". parent joncatanio 8 years ago