developmentseed / titiler

Build your own Raster dynamic map tile services
https://developmentseed.org/titiler/
MIT License
765 stars 157 forks source link

Jinja2Templates assertion error in starlette version >= 0.28 #743

Closed mkaminsky closed 8 months ago

mkaminsky commented 8 months ago

Problem description

  ...
  File "./main.py", line 9, in <module>
    from titiler.core.errors import DEFAULT_STATUS_CODES, add_exception_handlers
  File "..../lib/python3.11/site-packages/titiler/core/__init__.py", line 5, in <module>
    from . import dependencies, errors, factory, routing  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ..../lib/python3.11/site-packages/titiler/core/factory.py", line 73, in <module>
    DEFAULT_TEMPLATES = Jinja2Templates(
                        ^^^^^^^^^^^^^^^^
  File "..../lib/python3.11/site-packages/starlette/templating.py", line 103, in __init__
    assert directory or env, "either 'directory' or 'env' arguments must be passed"
AssertionError: either 'directory' or 'env' arguments must be passed

Expected Output

No assertion error.

Environment Information

Ubuntu 22.04, python3.11

tdrivas commented 8 months ago

Hello everyone,

I face the same problem both in Windows 10 and Ubuntu 20 using Python 3.10

Possible solution?

Thanks in advance!

mrgeorge commented 8 months ago

I've experienced the same issue. Requiring starlette < 0.28 in my pip env resolves it until @jasongi 's fix in #744 is released.

vincentsarago commented 8 months ago

thanks everyone 🙏

I've push 2 different releases with fixes: