Opened 3 years ago

Last modified 3 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 Marco Rizk)

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

Change History (1)

comment:1 by Marco Rizk, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top