olivierkes / manuskript

A open-source tool for writers
http://www.theologeek.ch/manuskript
GNU General Public License v3.0
1.77k stars 235 forks source link

All Imports are crashing #611

Closed Tobias004 closed 5 years ago

Tobias004 commented 5 years ago

Steps to reproduce:

Windows 10:

Result:


Debug: Web rendering engine used: QWebView
Running manuskript version 0.9.0.
Found translation in settings: manuskript_de.qm
Loaded translation from settings: manuskript_de.qm.
Loading: C:/Users/[..]/Documents/Buch/test.msk
Detected file format version: 1. Zip: True.
Projekt C:/Users/[..]/Documents/Buch/test.msk geladen.
Traceback (most recent call last):
  File "manuskript\ui\importers\importer.py", line 134, in selectFile
  File "manuskript\ui\importers\importer.py", line 240, in preview
  File "manuskript\ui\importers\importer.py", line 298, in startImport
  File "manuskript\importer\pandocImporters.py", line 23, in startImport
AttributeError: 'NoneType' object has no attribute 'value'
gedakc commented 5 years ago

Thank you @Tobias004 for the report.

I confirmed the bug by trying to import an HTML file on Windows 10 with Pandoc 2.0.1.

Additionally the bug occurred importing an HTML file on Kubuntu 16.04 with Pandoc 1.16.0.2.

worstje commented 5 years ago

I think I found the cause: https://github.com/olivierkes/manuskript/blob/60b6f98c21893375a54911d512fd0f88ef375ff7/manuskript/ui/importers/importer.py#L198-L200

The way the code seems to be structured implies that 'formatTo' is supposed to be a custom setting supplied by the converter, but merely uncommenting that line only causes a crash that I don't see the cause for right this second.

Seeing how it has gone unnoticed for over two years, and how some comments imply maintaining parity with the exporter after that is finished, I think this is a piece of code that was completely forgotten about. Most people must just use the builtin importers, making it so that the pandoc ones have fallen by the wayside.

This is looking like more than just the simple quick fix I was hoping it to be, but I'll see if I can dig into it one of these days to fix it. Hopefully it isn't too difficult of a task; I am not familiar with UI stuff so if the rabbit goes down that hole it will take me a while.

worstje commented 5 years ago

Slight update: that very line was indeed the cause of the problem, and reinstating it fixes it... and thus the above PR has arrived. 😄

The UI for specific importer settings looks a bit rough still and it makes me sort of understand why it was disabled at the time (assuming it was forgotten that pandoc imports need those settings)... but it is very much functional. We can worry about being nicely polished in the future.

gedakc commented 5 years ago

This bug was fixed in the develop branch with the merge of PR #612.

gedakc commented 5 years ago

This bug is neither windows specific, nor pandoc specific. It causes a crash on other OSes, and also with built-in import. As such I will rename the title.