Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#32887 closed Bug (invalid)

v3.2.4 regression - Invalid path type: PurePosixPath

Reported by: Damien Allen Owned by: nobody
Component: Utilities 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


After upgrading from v3.2.3 to v3.2.4 the runserver command is now raising a TypeError and exiting. After reviewing the v3.2.4 release notes, I suspect that this is related to changes to template directory traversal since get_template_directories() is in the traceback:

Performing system checks...

Traceback (most recent call last):
  File "", line 33, in <module>
  File "", line 29, in main
  File "/usr/local/lib/python3.8/site-packages/django/core/management/", line 419, in execute_from_command_line
  File "/usr/local/lib/python3.8/site-packages/django/core/management/", line 413, in execute
System check identified no issues (0 silenced).
  File "/usr/local/lib/python3.8/site-packages/django/core/management/", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/", line 61, in execute
    super().execute(*args, **options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/", line 398, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.8/site-packages/channels/management/commands/", line 65, in handle
    super().handle(*args, **options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/", line 96, in handle**options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/", line 103, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "/usr/local/lib/python3.8/site-packages/django/utils/", line 638, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/django/utils/", line 623, in start_django
  File "/usr/local/lib/python3.8/site-packages/django/utils/", line 328, in run
  File "/usr/local/lib/python3.8/site-packages/django/dispatch/", line 180, in send
    return [
  File "/usr/local/lib/python3.8/site-packages/django/dispatch/", line 181, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
  File "/usr/local/lib/python3.8/site-packages/django/template/", line 44, in watch_for_template_changes
    for directory in get_template_directories():
  File "/usr/local/lib/python3.8/site-packages/django/template/", line 21, in get_template_directories
    items.update(Path.cwd() / to_path(dir) for dir in backend.engine.dirs)
  File "/usr/local/lib/python3.8/site-packages/django/template/", line 21, in <genexpr>
    items.update(Path.cwd() / to_path(dir) for dir in backend.engine.dirs)
  File "/usr/local/lib/python3.8/site-packages/django/utils/", line 58, in to_path
    raise TypeError('Invalid path type: %s' % type(value).__name__)
TypeError: Invalid path type: PurePosixPath

Our Django is being run in a docker container (base image python:3.8.6-slim-buster) with WSL2 which could be related to funky path issues.

Reverting to v3.2.3 resolves the issue.

Change History (3)

comment:1 by Mariusz Felisiak, 3 years ago

Resolution: needsinfo
Status: newclosed

Thanks for the report. Is there a reason why you use pathlib.PurePath() (POSIX paths) instead of Path() (cross-OS paths) in your settings? This looks like a misconfiguration to me 🤔

comment:2 by Damien Allen, 3 years ago

We used a cookie-cutter template for our docker setup:

I will put in a PR over there, thanks for prompt reply!

comment:3 by Mariusz Felisiak, 3 years ago

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