Application won't start if it can't find a PDF file
Observed on Linux, current master (2.9.x I think)
To replicate:
- Import/open a PDF presentation.
- Close openlp and run it again, confirm the PDF is visible in the presentations list.
- Close openlp, delete the PDF file
- Run OpenLP again, application will fail to start, displaying this error:
Traceback (most recent call last):
File "./run_openlp.py", line 28, in <module>
__main__.start()
File "/home/joel/projects/openlp/openlp/__main__.py", line 75, in start
main()
File "/home/joel/projects/openlp/openlp/core/app.py", line 444, in main
sys.exit(app.run(qt_args, application))
File "/home/joel/projects/openlp/openlp/core/app.py", line 150, in run
Registry().execute('bootstrap_completion')
File "/home/joel/projects/openlp/openlp/core/common/registry.py", line 128, in execute
result = function(*args, **kwargs)
File "/home/joel/projects/openlp/openlp/core/lib/pluginmanager.py", line 90, in bootstrap_completion
plugin.app_startup()
File "/home/joel/projects/openlp/openlp/plugins/presentations/presentationplugin.py", line 140, in app_startup
self.media_item.clean_up_thumbnails(path, clean_for_update=True)
File "/home/joel/projects/openlp/openlp/plugins/presentations/lib/mediaitem.py", line 262, in clean_up_thumbnails
doc = self.controllers[cidx].add_document(file_path)
File "/home/joel/projects/openlp/openlp/plugins/presentations/lib/presentationcontroller.py", line 511, in add_document
document = self.document_class(self, document_path)
File "/home/joel/projects/openlp/openlp/plugins/presentations/lib/pdfcontroller.py", line 89, in __init__
super().__init__(controller, document_path)
File "/home/joel/projects/openlp/openlp/plugins/presentations/lib/presentationcontroller.py", line 102, in __init__
self._setup(document_path)
File "/home/joel/projects/openlp/openlp/plugins/presentations/lib/presentationcontroller.py", line 113, in _setup
create_paths(self.get_thumbnail_folder())
File "/home/joel/projects/openlp/openlp/plugins/presentations/lib/presentationcontroller.py", line 154, in get_thumbnail_folder
self._sha256_file_hash = sha256_file_hash(self.file_path)
File "/home/joel/projects/openlp/openlp/core/common/__init__.py", line 313, in sha256_file_hash
with open(filename, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/test_presentation.pdf'
Only current workaround without manually editing the database seems to be to create the presentation file again
Edited by Joel Fergusson