Xunius / Menotexport

Python solution to export annotations from your Mendeley library.
GNU General Public License v3.0
124 stars 20 forks source link

KeyError: 'tag' - meta['tags'] is list and folder not in meta['tag'] #9

Closed joep1 closed 7 years ago

joep1 commented 7 years ago

This is a really cool tool that's much needed, and I've been playing with a lot of individual scripts to do a Mendeley -> Zotero switch so having one single tool would be great (tags, pdf annotations, the lot in one!).

However, I am getting an issue with some pdfs as follows, and after staring at the code for ages (I'm not a great python programmer) I can't understand whether it's a problem with the code or with my database (which is messy, for sure). After running it from the GUI (even with just PDF + highlights checked, and with 'Save separately' either checked or not checked), it does a few files successfully and then eventually hits this error:

joep1@linuxmint ~/Desktop/Menotexport-master $ python menotexport-gui.py
Exception in thread work:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "menotexport-gui.py", line 73, in run
    menotexport.main(*self.args)
  File "/home/joep1/Desktop/Menotexport-master/menotexport.py", line 1291, in main
    fidii,fnameii,allfolders,action,separate,iszotero,verbose)
  File "/home/joep1/Desktop/Menotexport-master/menotexport.py", line 1003, in processFolder
    annotations = getHighlights(db,annotations,folderid,foldername)
  File "/home/joep1/Desktop/Menotexport-master/menotexport.py", line 388, in getHighlights
    elif type(meta['tags']) is list and folder not in meta['tag']:
KeyError: 'tag'
Xunius commented 7 years ago

Hi joep1,

Thanks for using the tool and providing feedbacks. The error is due to my stupid typo, it should be 'tags' not 'tag'. Sorry for the trouble. I've fixed it, you could either make the single change yourself, or download again. Please let me know if you encounter any other problems.

joep1 commented 7 years ago

Great, thanks! I updated it myself and it seems to work now :)

Also, whilst I am here, do you know:

1) If the warnings about character encoding for latex mean that the entry hasn't been successfully exported? Or will the character just be ignored?

e.g.

WARNING:lib.pylatexenc.latexencode:Character cannot be encoded into LaTeX: U+FFFC - `'

2) Is there any message or indication through the GUI when extraction is complete? It seems to have completed successfully but there is nothing particular in the terminal launcher or GUI to suggest 'Process Finished'.

Xunius commented 7 years ago

Hi, Regarding the latex character, I have no idea. That functionality was developed by another developer and I just imported his module. I'd guess it is a no, judging purely by the warning message.

In both the terminal and GUI it should give a message "All done" after all process finishes, or give a list of docs that it failed to process. If yours shows nothing then it could be somthing wrong. Did you find any docs missing in your output? And could you paste me the last few lines of messages it prints?

joep1 commented 7 years ago

Yes - you're correct, it shows what issues it encountered. I think I must have just missed it the first time I tried, or I can't reproduce the error anyway. Thanks though!