[Django] #32887: v3.2.4 regression - Invalid path type: PurePosixPath

10 views
Skip to first unread message

Django

unread,
Jun 28, 2021, 6:27:09 AM6/28/21
to django-...@googlegroups.com
#32887: v3.2.4 regression - Invalid path type: PurePosixPath
----------------------------------------+------------------------
Reporter: Damien Allen | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------+------------------------
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 "manage.py", line 33, in <module>
main()
File "manage.py", line 29, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/site-
packages/django/core/management/__init__.py", line 419, in
execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/site-
packages/django/core/management/__init__.py", line 413, in execute
System check identified no issues (0 silenced).
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.8/site-
packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.8/site-
packages/django/core/management/commands/runserver.py", line 61, in
execute
super().execute(*args, **options)
File "/usr/local/lib/python3.8/site-
packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.8/site-
packages/channels/management/commands/runserver.py", line 65, in handle
super().handle(*args, **options)
File "/usr/local/lib/python3.8/site-
packages/django/core/management/commands/runserver.py", line 96, in handle
self.run(**options)
File "/usr/local/lib/python3.8/site-
packages/django/core/management/commands/runserver.py", line 103, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "/usr/local/lib/python3.8/site-
packages/django/utils/autoreload.py", line 638, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "/usr/local/lib/python3.8/site-
packages/django/utils/autoreload.py", line 623, in start_django
reloader.run(django_main_thread)
File "/usr/local/lib/python3.8/site-
packages/django/utils/autoreload.py", line 328, in run
autoreload_started.send(sender=self)
File "/usr/local/lib/python3.8/site-
packages/django/dispatch/dispatcher.py", line 180, in send
return [
File "/usr/local/lib/python3.8/site-
packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/usr/local/lib/python3.8/site-
packages/django/template/autoreload.py", line 44, in
watch_for_template_changes
for directory in get_template_directories():
File "/usr/local/lib/python3.8/site-
packages/django/template/autoreload.py", 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/autoreload.py", 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/_os.py", 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/32887>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 28, 2021, 6:46:47 AM6/28/21
to django-...@googlegroups.com
#32887: v3.2.4 regression - Invalid path type: PurePosixPath
------------------------------+--------------------------------------

Reporter: Damien Allen | Owner: nobody
Type: Bug | Status: closed
Component: Utilities | Version: 3.2
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => needsinfo


Comment:

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 🤔

--
Ticket URL: <https://code.djangoproject.com/ticket/32887#comment:1>

Django

unread,
Jun 28, 2021, 6:53:45 AM6/28/21
to django-...@googlegroups.com
#32887: v3.2.4 regression - Invalid path type: PurePosixPath
------------------------------+--------------------------------------

Reporter: Damien Allen | Owner: nobody
Type: Bug | Status: closed
Component: Utilities | Version: 3.2
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------

Comment (by Damien Allen):

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

https://github.com/wemake-services/wemake-django-
template/blob/master/%7B%7Bcookiecutter.project_name%7D%7D/server/settings/components/__init__.py

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

--
Ticket URL: <https://code.djangoproject.com/ticket/32887#comment:2>

Django

unread,
Jun 28, 2021, 7:04:52 AM6/28/21
to django-...@googlegroups.com
#32887: v3.2.4 regression - Invalid path type: PurePosixPath
------------------------------+--------------------------------------

Reporter: Damien Allen | Owner: nobody
Type: Bug | Status: closed
Component: Utilities | Version: 3.2
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* resolution: needsinfo => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/32887#comment:3>

Reply all
Reply to author
Forward
0 new messages