lepture / python-livereload

livereload server in python
https://livereload.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
1.02k stars 150 forks source link

'Server' object has no attribute 'default_filename' #233

Open mamueHH opened 4 years ago

mamueHH commented 4 years ago

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'
pradyunsg commented 4 years ago

Could you share a minimal script to reproduce this issue?

ziotom78 commented 3 years ago

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 3 years ago

@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: https://github.com/markdownreveal/markdownreveal/issues/53 :blush: