diff options
author | njsmith <njs@pobox.com> | 2013-02-28 10:35:37 -0800 |
---|---|---|
committer | njsmith <njs@pobox.com> | 2013-02-28 10:35:37 -0800 |
commit | 2cb5021f2110f7e24a6a30a3a0af8336f46fb621 (patch) | |
tree | eb7a8a5043ab20b1e15e92cea0c6c7ceb57c4eb9 /doc/numpybook/runcode.py | |
parent | ceca28d920225715870d0a83394385e320d1bb22 (diff) | |
parent | 2429298dd8ddf797c3c89e65eb8a9b9e8f72a299 (diff) | |
download | numpy-2cb5021f2110f7e24a6a30a3a0af8336f46fb621.tar.gz |
Merge pull request #3049 from charris/2to3-exec
2to3: apply exec fixer results.
Diffstat (limited to 'doc/numpybook/runcode.py')
-rw-r--r-- | doc/numpybook/runcode.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/numpybook/runcode.py b/doc/numpybook/runcode.py index 7e696c9b3..7ec303500 100644 --- a/doc/numpybook/runcode.py +++ b/doc/numpybook/runcode.py @@ -33,7 +33,7 @@ def getoutput(tstr, dic): except SyntaxError: try: res = None - exec code in dic + exec(code, dic) finally: sys.stdout = sys.__stdout__ if res is None: @@ -94,8 +94,8 @@ def runpycode(lyxstr, name='MyCode'): del indx[0] indx.append(len(lyxstr)) edic = {} - exec 'from numpy import *' in edic - exec 'set_printoptions(linewidth=65)' in edic + exec('from numpy import *', edic) + exec('set_printoptions(linewidth=65)', edic) # indx now contains [st0,en0, ..., stN,enN] # where stX is the start of code segment X # and enX is the start of \layout MyCode for @@ -109,8 +109,8 @@ def runpycode(lyxstr, name='MyCode'): # if PYNEW found, then start a new namespace if mat: edic = {} - exec 'from numpy import *' in edic - exec 'set_printoptions(linewidth=65)' in edic + exec('from numpy import *', edic) + exec('set_printoptions(linewidth=65)', edic) # now find the code in the code segment # endoutput will contain the index just past any output # already present in the lyx string. |