regebro / hovercraft

Make dynamic impressive presentations from text files!
https://hovercraft.readthedocs.org
MIT License
1.48k stars 209 forks source link

Error when presentation file does not exists #211

Closed yeyeto2788 closed 4 years ago

yeyeto2788 commented 4 years ago

Hey @regebro, just found an issue when the presentation does not exists firing up this command hovercraft -t simple -p 5050 sample:

(venv) C:\workspace\git\bundle>hovercraft -t simple -p 5050 sample
Serving HTTP on 0.0.0.0 port 5050 ...
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python37-32\Lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "C:\Program Files (x86)\Python37-32\Lib\threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "c:\workspace\git\bundle\venv\lib\site-packages\hovercraft\__init__.py", line 45, in generate_and_observe
    monitor_list = generate(args)
  File "c:\workspace\git\bundle\venv\lib\site-packages\hovercraft\generate.py", line 166, in generate
    args.slide_numbers)
  File "c:\workspace\git\bundle\venv\lib\site-packages\hovercraft\generate.py", line 23, in rst2html
    with open(filepath, 'rb') as infile:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\workspace\\git\\bundle\\sample'

So I guess we should check if the presentation exists before firing the server itself. It will also fail if we pass the targetdir argument.

I'll open a PR with a proposal.

Regards.

yeyeto2788 commented 4 years ago

Closing this issue since there is a fix for this on PR https://github.com/regebro/hovercraft/pull/212.

Regards.