Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run -p doesn't work in python 3 #1044

Closed
Gitusername opened this issue Nov 25, 2011 · 1 comment
Closed

run -p doesn't work in python 3 #1044

Gitusername opened this issue Nov 25, 2011 · 1 comment
Milestone

Comments

@Gitusername
Copy link

In python 3.2.2 and ipython 0.11, I can't get run -p to work - as far as I can see, this is because of the use of execfile which was removed in python 3 (it doesn't look like this has been fixed in the development version, but I haven't tried it).

In [11]: run -p test
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/.../test.py in <module>()
----> 1 get_ipython().magic("run -p plots")

/usr/local/lib/python3.2/dist-packages/IPython/core/interactiveshell.py in magic(self, arg_s, next_input)
   1869                 self._magic_locals = sys._getframe(1).f_locals
   1870             with self.builtin_trap:
-> 1871                 result = fn(magic_args)
   1872             # Ensure we're not keeping object references around:

   1873             self._magic_locals = {}

/usr/local/lib/python3.2/dist-packages/IPython/core/magic.py in magic_run(self, parameter_s, runner, file_finder)
   1617             with self.readline_no_record:
   1618                 if 'p' in opts:
-> 1619                     stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
   1620                 else:
   1621                     if 'd' in opts:

/usr/local/lib/python3.2/dist-packages/IPython/core/magic.py in magic_prun(self, parameter_s, user_mode, opts, arg_lst, prog_ns)
   1377         prof = profile.Profile()
   1378         try:
-> 1379             prof = prof.runctx(arg_str,namespace,namespace)
   1380             sys_exit = ''
   1381         except SystemExit:

/usr/lib/python3.2/cProfile.py in runctx(self, cmd, globals, locals)
    133         self.enable()
    134         try:
--> 135             exec(cmd, globals, locals)
    136         finally:
    137             self.disable()

/.../<string> in <module>()

NameError: name 'execfile' is not defined
@takluyver
Copy link
Member

Thanks - it's been fixed in trunk already (Pull Request #916).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants