peterjc / mediawiki_to_git_md

Convert a MediaWiki export XML file into MarkDown as a series of git commits
MIT License
55 stars 17 forks source link

Exception in subprocess when pandoc not installed #22

Closed jayvdb closed 8 years ago

jayvdb commented 8 years ago

Obviously pandoc is necessary, but when it isnt present the error doesnt indicate what went wrong.

Somewhat related, I've raised a bug in sarge as they are providing a nicer subprocess manager; maybe they can solve this.

Another way to approach this problem is to depend on another package which ensures that pandoc has been installed.

Ubuntu only provides one python wrapper pandocfilters for wily*, and also pypandoc since yakkety *.

pandocfilters doesnt even check that pandoc is installed (https://github.com/jgm/pandocfilters/blob/master/setup.py) - and it appears to have some compatibility issues with different versions of pandoc (https://github.com/jgm/pandocfilters#compatibility)

The two python wrappers that are in Fedora are pandocfilters * and pypandoc *

On Fedora, pypandoc package had a huge extra dependency tree, mostly of texlive addons. i.e. in addition to the main pandoc package (which has lots of texlive dependencies).

$ sudo dnf install python2-pypandoc python3-pypandoc
....
...
Installed:
  python2-pypandoc.noarch 1.1.3-1.fc24                                  python3-pypandoc.noarch 1.1.3-1.fc24                                                           
  texlive-avantgar.noarch 5:svn31835.0-24.fc24.1                        texlive-bookman.noarch 5:svn31835.0-24.fc24.1                                                  
  texlive-charter.noarch 5:svn15878.0-24.fc24.1                         texlive-cm-super.noarch 5:svn15878.0-24.fc24.1                                                 
  texlive-cmextra.noarch 5:svn32831.0-24.fc24.1                         texlive-collection-fontsrecommended.noarch 5:svn35830.0-24.20150728_r37987.fc24.1              
  texlive-courier.noarch 5:svn35058.0-24.fc24.1                         texlive-euro.noarch 5:svn22191.1.1-24.fc24.1                                                   
  texlive-eurosym.noarch 5:svn17265.1.4_subrfix-24.fc24.1               texlive-fpl.noarch 5:svn15878.1.002-24.fc24.1                                                  
  texlive-helvetic.noarch 5:svn31835.0-24.fc24.1                        texlive-lm-math.noarch 5:svn36915.1.959-24.fc24.1                                              
  texlive-manfnt-font.noarch 5:svn35799.0-24.fc24.1                     texlive-mathpazo.noarch 5:svn15878.1.003-24.fc24.1                                             
  texlive-mflogo-font.noarch 5:svn36898.1.002-24.fc24.1                 texlive-ncntrsbk.noarch 5:svn31835.0-24.fc24.1                                                 
  texlive-palatino.noarch 5:svn31835.0-24.fc24.1                        texlive-pxfonts.noarch 5:svn15878.0-24.fc24.1                                                  
  texlive-rsfs.noarch 5:svn15878.0-24.fc24.1                            texlive-scheme-basic.noarch 5:svn25923.0-24.20150728_r37987.fc24.1                             
  texlive-symbol.noarch 5:svn31835.0-24.fc24.1                          texlive-tex-gyre.noarch 5:svn18651.2.004-24.fc24.1                                             
  texlive-tex-gyre-math.noarch 5:svn36916.0-24.fc24.1                   texlive-times.noarch 5:svn35058.0-24.fc24.1                                                    
  texlive-txfonts.noarch 5:svn15878.0-24.fc24.1                         texlive-utopia.noarch 5:svn15878.0-24.fc24.1                                                   
  texlive-wasy.noarch 5:svn35831.0-24.fc24.1                            texlive-wasy2-ps.noarch 5:svn35830.0-24.fc24.1                                                 
  texlive-wasysym.noarch 5:svn15878.2.0-24.fc24.1                       texlive-zapfchan.noarch 5:svn31835.0-24.fc24.1          

For other OS (especially Windows), or if someone wants to install pypandoc manually (or via pip), it will also installs pandoc!

there are other packages which might be a simpler wrapper with verification that the pandoc binary is installed.

peterjc commented 8 years ago

Hopefully this is much nicer, should now get:

$ ./convert.py
Could not find pandoc on $PATH
jayvdb commented 8 years ago

Nice!