Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#18827 closed Bug (fixed)

Exclude __pycache__ from module detection

Reported by: Aymeric Augustin Owned by: nobody
Component: Python 3 Version: master
Severity: Normal Keywords:
Cc: bhuztez@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If you make a typo in the database backend you get this error message on Python 3:

Try using django.db.backends.XXX, where XXX is one of:
    '__pycache__', 'dummy', 'mysql', 'oracle', 'postgresql_psycopg2', 'sqlite3'

At least __pycache__ should be filtered out. Maybe dummy too.

It would be nice to check if this pattern occurs in other places in Django.

(One more reason not to attempt listing modules in a package...)

Attachments (1)

18827-1.diff (900 bytes) - added by Claude Paroz 4 years ago.
Use pkgutil to list packages

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by Claude Paroz

Attachment: 18827-1.diff added

Use pkgutil to list packages

comment:1 Changed 4 years ago by Claude Paroz

Has patch: set
Triage Stage: UnreviewedAccepted

Related tickets: #8280, #15084

comment:2 Changed 4 years ago by bhuztez

Cc: bhuztez@… added

also #18603

comment:3 Changed 4 years ago by Ramiro Morales

Resolution: fixed
Status: newclosed

comment:4 Changed 4 years ago by Claude Paroz <claude@…>

In 34a736b7521def321b2104d541e634134c5d1c62:

Used pkgutil to get list of backend modules

Refs #18827.

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