Opened 4 years ago
Last modified 4 years ago
#33081 closed Bug
TypeError: scandir: path should be string, bytes, os.PathLike or None, not function — at Version 1
| Reported by: | Marco Rizk | Owned by: | nobody |
|---|---|---|---|
| Component: | Forms | Version: | 3.2 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
When using a FilePathField as follows
def chunk_path():
return os.path.join(settings.MEDIA_ROOT, 'footage/chunks')
file = models.FilePathField(path=chunk_path, max_length=200)
I get the error stack of
File "xxxxxxx/venv/lib/python3.6/site-packages/django/forms/fields.py", line 1126, in __init__
for f in os.scandir(self.path):
TypeError: scandir: path should be string, bytes, os.PathLike or None, not function
Note:
See TracTickets
for help on using tickets.