Line 148 of this views.py file (permalink) is throwing the error:
TypeError at /run_make/manual_ingest
expected str, bytes or os.PathLike object, not PosixPath
Here are the project’s settings.py (permalink).
The code used to work. I’ve read online that the problem results from a breaking change in newer versions of Django. Those sources suggested that the problem was probably that I was setting some db path to be posix, and I should cast those paths to strings. I tried wrapping everything that seemed reasonable in the str()
function – every path defined in settings.py
, and the second argument to render()
– to no avail.
Here are the later details of the error message:
Request Method: GET
Request URL: http://localhost:8000/microsim/run_make/manual_ingest
Django Version: 4.1
Exception Type: TypeError
Exception Value: expected str, bytes or os.PathLike object, not PosixPath
Exception Location: /usr/lib/python3.9/posixpath.py, line 76, in join
Raised during: run_make.views.views.manual_ingest
Python Executable: /usr/bin/python3
Python Version: 3.9.2
Server time: Thu, 30 Mar 2023 16:49:49 -0500
Python Path: ['/mnt/django',
'/mnt/apache2',
'/opt/conda/lib/python3.9/site-packages',
'/usr/lib/python39.zip',
'/usr/lib/python3.9',
'/usr/lib/python3.9/lib-dynload',
'/usr/local/lib/python3.9/dist-packages',
'/usr/lib/python3/dist-packages']