Skip to content

TypeError: object of type 'NoneType' has no len() #193

@mplewis

Description

@mplewis

Hello! I'm having trouble using Excalibur out of the box.

What I did

Installed Excalibur and set it up:

pip install excalibur-py
excalibur initdb
excalibur webserver

Then, uploaded a PDF via the web interface.

Expected behavior

Excalibur extracts data from my PDF for me.

Actual behavior

I receive a 500 Internal Server Error at http://localhost:5000/workspaces/c644cced-85fe-42a7-92c9-aa6dcc6fc72a:

excalibur webserver
 * Serving Flask app 'excalibur.www.app'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
127.0.0.1 - - [08/Jan/2025 11:40:05] "GET / HTTP/1.1" 302 -
127.0.0.1 - - [08/Jan/2025 11:40:05] "GET /files HTTP/1.1" 200 -
127.0.0.1 - - [08/Jan/2025 11:40:05] "GET /static/css/vendor/bootstrap.min.css HTTP/1.1" 200 -
127.0.0.1 - - [08/Jan/2025 11:40:05] "GET /static/js/vendor/jquery-3.3.1.min.js HTTP/1.1" 200 -
127.0.0.1 - - [08/Jan/2025 11:40:05] "GET /static/css/base.css HTTP/1.1" 200 -
127.0.0.1 - - [08/Jan/2025 11:40:05] "GET /static/js/vendor/popper.min.js HTTP/1.1" 200 -
127.0.0.1 - - [08/Jan/2025 11:40:05] "GET /static/js/vendor/bootstrap.min.js HTTP/1.1" 200 -
127.0.0.1 - - [08/Jan/2025 11:40:05] "GET /static/js/files.js HTTP/1.1" 200 -
127.0.0.1 - - [08/Jan/2025 11:40:05] "GET /static/favicon.ico HTTP/1.1" 200 -
127.0.0.1 - - [08/Jan/2025 11:40:12] "POST /files HTTP/1.1" 200 -
[2025-01-08 11:40:12,401] ERROR in app: Exception on /workspaces/c644cced-85fe-42a7-92c9-aa6dcc6fc72a [GET]
Traceback (most recent call last):
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/flask/app.py", line 1511, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/flask/app.py", line 919, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/excalibur/www/views.py", line 106, in workspaces
    return render_template(
           ^^^^^^^^^^^^^^^^
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/flask/templating.py", line 150, in render_template
    return _render(app, template, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/flask/templating.py", line 131, in _render
    rv = template.render(context)
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/jinja2/environment.py", line 1295, in render
    self.environment.handle_exception()
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/jinja2/environment.py", line 942, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/excalibur/www/templates/workspace.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/excalibur/www/templates/base.html", line 61, in top-level template code
    {% block workspace %}{% endblock %}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mplewis/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/excalibur/www/templates/workspace.html", line 12, in block 'workspace'
    {% if imagepaths is not none or imagepaths|length == 0 %}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
127.0.0.1 - - [08/Jan/2025 11:40:12] "GET /workspaces/c644cced-85fe-42a7-92c9-aa6dcc6fc72a HTTP/1.1" 500 -

Versions

>>> import platform; print(platform.platform())
macOS-15.2-arm64-arm-64bit
>>> import sys; print('Python', sys.version)
Python 3.12.7 (main, Oct  2 2024, 15:45:55) [Clang 18.1.8 ]
>>> import numpy; print('NumPy', numpy.__version__)
NumPy 2.2.1
>>> import cv2; print('OpenCV', cv2.__version__)
OpenCV 4.10.0
>>> import excalibur; print('Excalibur', excalibur.__version__)
Excalibur 1.0.1

Let me know if I can provide any more info to help you replicate this issue. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions