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

Closed
ShereKahn opened this Issue Feb 19, 2012 · 2 comments

Comments

Projects
None yet
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

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Feb 19, 2012

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.

Member

takluyver commented Feb 19, 2012

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

This comment has been minimized.

Show comment
Hide comment
@yigiter

yigiter Mar 6, 2012

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)

yigiter commented Mar 6, 2012

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 Apr 15, 2012

jenshnielsen pushed a commit to jenshnielsen/ipython that referenced this issue Apr 16, 2012

Merge pull request #1599 from takluyver/run-d-py3
Fix for %run -d on Python 3.

Closes gh-1421.

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

Merge pull request #1599 from takluyver/run-d-py3
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