Opened 7 years ago

Closed 4 years ago

#12206 closed New feature (duplicate)

manage.py fails if management commands directory contains only bytecode files

Reported by: anonymous Owned by: nobody
Component: Core (Management commands) Version: 1.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If the django/core/management/commands directory has only bytecode files (.pyc or .pyo) instead of source files, running manage.py (or using the call_command function) will always fail with "unknown command".

This happens because the find_commands function in django/core/management/init.py only searches the commands directory for .py files.

Attachments (1)

12206.diff (679 bytes) - added by wenjoseph 7 years ago.
Search for .py, .pyc and .pyo

Download all attachments as: .zip

Change History (7)

comment:1 Changed 7 years ago by Russell Keith-Magee

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

Changed 7 years ago by wenjoseph

Attachment: 12206.diff added

Search for .py, .pyc and .pyo

comment:2 Changed 5 years ago by Matt McClanahan

Severity: Normal
Type: New feature

comment:3 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:4 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:5 Changed 5 years ago by Carl Meyer

pyc files are an internal implementation detail of CPython and can't be relied on (in Python 3 they've already been moved into a __pycache__ subdirectory), so any patch that just changes Django to explicitly look for pyc files next to the py files is using an already-obsolete implementation detail.

The right approach here is to fix management command finding more generally so that it uses the proper Python APIs for finding and loading modules. There are patches on #14087 that do this, and should fix this too.

comment:6 Changed 4 years ago by Claude Paroz

Resolution: duplicate
Status: newclosed

Closing this one as a duplicate of #14087.

Note: See TracTickets for help on using tickets.
Back to Top