lepture/python-livereload

'Server' object has no attribute 'default_filename'

mamueHH opened this issue · 3 comments

livereload 2.6.3
Got an exception 'Server' object has no attribute 'default_filename', full stack trace below
Cause: missing initialization of self.default_filename in Server's __init__

Traceback (most recent call last):
  File "./markdownreveal", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/mam/.local/lib/python3.8/site-packages/markdownreveal/commands.py", line 80, in show
    server.application(port, host, liveport=None, debug=True, live_css=True)
  File "/home/mam/.local/lib/python3.8/site-packages/livereload/server.py", line 279, in application
    web_handlers = self.get_web_handlers(live_script)
  File "/home/mam/.local/lib/python3.8/site-packages/livereload/server.py", line 309, in get_web_handlers
    'default_filename': self.default_filename,
AttributeError: 'Server' object has no attribute 'default_filename'

Could you share a minimal script to reproduce this issue?

I have got the same error while trying to use markdownreveal 0.3.5 with Python 3.8.3, which seems to be the same case as @mamueFM. Steps to reproduce:

pip install markdownreveal==0.3.5
echo -e "# Test\n\nThis is a test" > test.md
markdownreveal test.md

I am not sure this is a problem with python-livereload; I believe that markdownreveal should call Server.serve instead of Server.application.

Peque commented

@ziotom78 I just updated Markdownreveal. Try to install the latest release (0.3.6) and see if it works for you.

The fix consisted on simply downgrading livereload to 2.6.2. If you want to contribute a fix to make it compatible with the latest livereload release, you are more than welcome: markdownreveal/markdownreveal#53 😊