Opened 7 years ago

Closed 4 years ago

#12206 closed New feature (duplicate) 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


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

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

Attachments (1)

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

Download all attachments as: .zip

Change History (7)

comment:1 Changed 6 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 6 years ago by wenjoseph

Search for .py, .pyc and .pyo

comment:2 Changed 5 years ago by mattmcc

  • Severity set to Normal
  • Type set to New feature

comment:3 Changed 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:4 Changed 4 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:5 Changed 4 years ago by carljm

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 claudep

  • Resolution set to duplicate
  • Status changed from new to closed

Closing this one as a duplicate of #14087.

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