Skip to content

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

ShereKahn opened this Issue Feb 19, 2012 · 2 comments

3 participants

In [175]: %run -d -b109 parser
Breakpoint 1 at /Users/ShereKahn/Prog/Clojure/Alatar/Data/
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
IPython member

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 commented Mar 6, 2012

In case anybody needs, here is the quickfix:

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

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

@takluyver takluyver added a commit that closed this issue Apr 15, 2012
@takluyver takluyver Fix for %run -d on Python 3
Closes gh-1421
@takluyver takluyver closed this in 3e1a509 Apr 15, 2012
@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
@takluyver takluyver Fix for %run -d on Python 3
Closes gh-1421
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.