Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ipython32 %run -d breaks with NameError name 'execfile' is not defined #1421

Closed
ShereKahn opened this Issue · 2 comments

3 participants

@ShereKahn
In [175]: %run -d -b109 parser
Breakpoint 1 at /Users/ShereKahn/Prog/Clojure/Alatar/Data/parser.py:109
NOTE: Enter 'c' at the ipdb>  prompt to start your script.
> <string>(1)<module>()

ipdb> c
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
NameError: name 'execfile' is not defined
@takluyver
Owner

Looks like there's a few stray execfiles that weren't taken care of for Python 3.

I'm marking this quickfix, since it should be relatively easy to refer them to execfile in py3compat.

We're having an introduction to contributing to open source Python projects on the 28th, so I'm asking people to leave this (and other quickfix bugs) for people to fix at that evening. If it's an urgent problem, you can of course patch your own installation.

@yigiter

In case anybody needs, here is the quickfix:

Modify the following 2 lines in /core/magic.py as shown below:
Line 1488:
#arg_str = 'execfile(filename,prog_ns)'
arg_str = 'exec(compile(open(filename).read(), filename, "exec"), prog_ns)'

Line 1798:
#deb.run('execfile("%s")' % filename, prog_ns)
deb.run('exec(compile(open("%s").read(), "%s", "exec"))' %(filename,filename), prog_ns)

@takluyver takluyver closed this in 3e1a509
@mattvonrocketstein mattvonrocketstein referenced this issue from a commit in mattvonrocketstein/ipython
@takluyver takluyver Fix for %run -d on Python 3
Closes gh-1421
cfbe2c4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.