[Django] #27670: Genuine ImportError masked by exception handling code when loading shell

14 views
Skip to first unread message

Django

unread,
Jan 1, 2017, 8:00:34 AM1/1/17
to django-...@googlegroups.com
#27670: Genuine ImportError masked by exception handling code when loading shell
-------------------------------------+-------------------------------------
Reporter: Peter | Owner: nobody
Inglesby |
Type: Bug | Status: new
Component: Core | Version: 1.10
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
When I run `./manage.py shell`, I get `ImportError: Couldn't load any of
the specified interfaces.`

It turns out that there's a problem with my readline installation which
causes an `ImportError`. This `ImportError` is caught and discarded by
the `except ImportError` in
`django.core.management.commands.shell.Command.handle`.

Pull request incoming.

--
Ticket URL: <https://code.djangoproject.com/ticket/27670>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 1, 2017, 8:00:48 AM1/1/17
to django-...@googlegroups.com
#27670: Genuine ImportError masked by exception handling code when loading shell
-------------------------------------+-------------------------------------
Reporter: Peter Inglesby | Owner: Peter
| Inglesby
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.10
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Peter Inglesby):

* owner: nobody => Peter Inglesby
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/27670#comment:1>

Django

unread,
Jan 1, 2017, 9:19:26 AM1/1/17
to django-...@googlegroups.com
#27670: Genuine ImportError masked by exception handling code when loading shell
-------------------------------------+-------------------------------------
Reporter: Peter Inglesby | Owner: Peter
| Inglesby
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.10
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Peter Inglesby):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/27670#comment:2>

Django

unread,
Jan 2, 2017, 7:49:03 PM1/2/17
to django-...@googlegroups.com
#27670: Genuine ImportError masked by exception handling code when loading shell
-------------------------------------+-------------------------------------
Reporter: Peter Inglesby | Owner: Peter
| Inglesby
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.10
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/27670#comment:3>

Django

unread,
Jun 27, 2017, 10:00:17 AM6/27/17
to django-...@googlegroups.com
#27670: Genuine ImportError masked by exception handling code when loading shell
-------------------------------------+-------------------------------------
Reporter: Peter Inglesby | Owner: Peter
| Inglesby
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.10
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

Peter, are you still planning to provide a patch here?

--
Ticket URL: <https://code.djangoproject.com/ticket/27670#comment:4>

Django

unread,
Jun 29, 2017, 7:34:15 AM6/29/17
to django-...@googlegroups.com
#27670: Loading shell crashes when pythonrc file contains error

-------------------------------------+-------------------------------------
Reporter: Peter Inglesby | Owner: Peter
| Inglesby
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.10
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Peter Inglesby:

Old description:

> When I run `./manage.py shell`, I get `ImportError: Couldn't load any of
> the specified interfaces.`
>
> It turns out that there's a problem with my readline installation which
> causes an `ImportError`. This `ImportError` is caught and discarded by
> the `except ImportError` in
> `django.core.management.commands.shell.Command.handle`.
>
> Pull request incoming.

New description:

If a pythonrc file (either `~/.pythonrc`, or `$PYTHONHOME`) causes an
exception, then `./manage.py shell` crashes.

By contrast, CPython prints the exception and continues.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27670#comment:5>

Django

unread,
Jun 29, 2017, 2:50:15 PM6/29/17
to django-...@googlegroups.com
#27670: Loading shell crashes when pythonrc file contains error
-------------------------------------+-------------------------------------
Reporter: Peter Inglesby | Owner: Peter
| Inglesby
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.10
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


Comment:

[https://github.com/django/django/pull/8688 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/27670#comment:6>

Django

unread,
Jul 6, 2017, 8:17:41 AM7/6/17
to django-...@googlegroups.com
#27670: Loading shell crashes when pythonrc file contains error
-------------------------------------+-------------------------------------
Reporter: Peter Inglesby | Owner: Peter
| Inglesby
Type: Bug | Status: closed

Component: Core (Management | Version: 1.10
commands) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"0ba57c395796a5644cd0f880ac9fa7052d318021" 0ba57c3]:
{{{
#!CommitTicketReference repository=""
revision="0ba57c395796a5644cd0f880ac9fa7052d318021"
Fixed #27670 -- Prevented shell crash on error in .pythonrc.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27670#comment:7>

Reply all
Reply to author
Forward
0 new messages