Commit 723c9a8c authored by Aymeric Augustin's avatar Aymeric Augustin
Browse files

[py3] Ported the 'shell' management command.

The user module and the execfile function were removed in Python 3.

Thanks Linovia for the report.
parent adbdb18a
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -80,14 +80,14 @@ class Command(NoArgsCommand):
                readline.parse_and_bind("tab:complete")

            # We want to honor both $PYTHONSTARTUP and .pythonrc.py, so follow system
            # conventions and get $PYTHONSTARTUP first then import user.
            # conventions and get $PYTHONSTARTUP first then .pythonrc.py.
            if not use_plain:
                pythonrc = os.environ.get("PYTHONSTARTUP")
                for pythonrc in (os.environ.get("PYTHONSTARTUP"),
                                 os.path.expanduser('~/.pythonrc.py')):
                    if pythonrc and os.path.isfile(pythonrc):
                        try:
                        execfile(pythonrc)
                            with open(pythonrc) as handle:
                                exec(compile(handle.read(), pythonrc, 'exec'))
                        except NameError:
                            pass
                # This will import .pythonrc.py as a side-effect
                import user
            code.interact(local=imported_objects)