simonw / datasette

An open source multi-tool for exploring and publishing data
https://datasette.io
Apache License 2.0
9.59k stars 691 forks source link

Cannot install plugins on desktop variant #2315

Open thomersch opened 7 months ago

thomersch commented 7 months ago

I've got Datasette Desktop 0.2.2, Datasette: 0.64.1, Python: 3.9.6, SQLite: 3.36.0 and when I open "Install and Manage Plugins", I get an Error 500 "'NoneType' object has no attribute 'day'"

Opening the server log shows this:

 Traceback (most recent call last):
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette/app.py", line 1354, in route_path
     response = await view(request, send)
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette/views/base.py", line 134, in view
     return await self.dispatch_request(request)
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette/views/base.py", line 91, in dispatch_request
     return await handler(request)
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette/views/base.py", line 516, in get
     r = await self.render(templates, request=request, context=context)
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette/views/base.py", line 121, in render
     await self.ds.render_template(
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette/app.py", line 1099, in render_template
     return await template.render_async(template_context)
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/jinja2/environment.py", line 1324, in render_async
     return self.environment.handle_exception()
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
     raise rewrite_traceback_stack(source=source)
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/jinja2/environment.py", line 1321, in <listcomp>
     [n async for n in self.root_render_func(ctx)]  # type: ignore
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette_app_support/templates/table-plugin_directory-plugins.html", line 1, in top-level template code
     {% extends "default:table.html" %}
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette/templates/table.html", line 1, in top-level template code
     {% extends "base.html" %}
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette/templates/base.html", line 60, in top-level template code
     {% block content %}
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette/templates/table.html", line 152, in block 'content'
     {% include custom_table_templates %}
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette_app_support/templates/_table-table-plugin_directory-plugins.html", line 31, in top-level template code
     <p><strong>Latest release:</strong> {{ row.tag_name }} on {{ prettydate(row.latest_release_at) }}</p>
   File "/Users/sthomas/.datasette-app/venv/lib/python3.9/site-packages/datasette_app_support/__init__.py", line 355, in prettydate
     day=date.day,
 AttributeError: 'NoneType' object has no attribute 'day'
havardgulldahl commented 7 months ago

I have the same issue as @thomersch . I did the following adhoc change to the prettydate() function, which seems to have solved it. At least the plugin selection screen is shown now.

    try:
        return "{day}{suffix} {month} {year}".format(
            day=date.day,
            month=date.strftime("%B"),
            suffix=suffix(date.day),
            year=date.year,
        )
    except:
        return date
balabis commented 7 months ago

Same here. Installed the application, wanted to install a plugin and got the same error.

bigloudjeff commented 7 months ago

I'm having the same issue. Please let us know what we can do to help debug it.

bigloudjeff commented 6 months ago

I have the same issue as @thomersch . I did the following adhoc change to the prettydate() function, which seems to have solved it. At least the plugin selection screen is shown now.

    try:
        return "{day}{suffix} {month} {year}".format(
            day=date.day,
            month=date.strftime("%B"),
            suffix=suffix(date.day),
            year=date.year,
        )
    except:
        return date

@havardgulldahl can you please give some more details on which file you made the change in. Where would I find that file on disk? Thanks.

clintmiller commented 3 months ago

@bigloudjeff That function (prettydate()) is in this file: /Users/<your username here>/.datasette-app/venv/lib/python3.9/site-packages/datasette_app_support/__init__.py. @havardgulldahl replaced the entire body of that function with the snippet.