diff --git a/openlp/core/common/httputils.py b/openlp/core/common/httputils.py index c6e0f2f58..c9a555a55 100644 --- a/openlp/core/common/httputils.py +++ b/openlp/core/common/httputils.py @@ -256,13 +256,13 @@ class DownloadWorker(ThreadWorker): return try: dest_path = Path(gettempdir()) / 'openlp' / self._file_name - url = f'{self._base_url}{self._file_name}' + url = '{url}{name}'.format(url=self._base_url, name=self._file_name) is_success = download_file(self, url, dest_path) if is_success and not self._download_cancelled: self.download_succeeded.emit(dest_path) else: self.download_failed.emit() - except: # noqa + except Exception: log.exception('Unable to download %s', url) self.download_failed.emit() finally: diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index ef223e8f1..d5f48e2d7 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -67,7 +67,7 @@ class ThemeListWidgetItem(QtWidgets.QListWidgetItem): worker = DownloadWorker(themes_url, thumbnail) worker.download_failed.connect(self._on_download_failed) worker.download_succeeded.connect(self._on_thumbnail_downloaded) - thread_name = f'thumbnail_download_{thumbnail}' + thread_name = 'thumbnail_download_{thumbnail}'.format(thumbnail=thumbnail) run_thread(worker, thread_name) ftw.thumbnail_download_threads.append(thread_name) @@ -396,7 +396,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): iterator += 1 # Loop through the themes list and increase for each selected item for item in self.themes_list_widget.selectedItems(): - size = get_url_file_size(f'{self.themes_url}{item.file_name}') + size = get_url_file_size('{url}{file}'.format(url=self.themes_url, file=item.file_name)) self.max_progress += size except urllib.error.URLError: trace_error_handler(log) @@ -517,9 +517,9 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): for item in self.themes_list_widget.selectedItems(): self._increment_progress_bar(self.downloading.format(name=item.file_name), 0) self.previous_size = 0 - if not download_file( - self, f'{self.themes_url}{item.file_name}', themes_destination_path / item.file_name, item.sha256): - missed_files.append(f'Theme: {item.file_name}') + if not download_file(self, '{url}{file}'.format(url=self.themes_url, file=item.file_name), + themes_destination_path / item.file_name, item.sha256): + missed_files.append('Theme: name'.format(name=item.file_name)) if missed_files: file_list = '' for entry in missed_files: