Opened 15 years ago
Closed 13 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)
Change History (7)
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 15 years ago
Attachment: | 12206.diff added |
---|
comment:2 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:5 by , 13 years ago
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 by , 13 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Closing this one as a duplicate of #14087.
Search for .py, .pyc and .pyo