datasette icon indicating copy to clipboard operation
datasette copied to clipboard

Cannot install plugins on desktop variant

Open thomersch opened this issue 1 year ago • 5 comments

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'

thomersch avatar Apr 02 '24 08:04 thomersch

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 avatar Apr 10 '24 11:04 havardgulldahl

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

balabis avatar Apr 11 '24 18:04 balabis

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

bigloudjeff avatar Apr 29 '24 20:04 bigloudjeff

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.

bigloudjeff avatar May 07 '24 15:05 bigloudjeff

@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.

clintmiller avatar Aug 22 '24 20:08 clintmiller