OliverBalfour / obsidian-pandoc

Pandoc document export plugin for Obsidian (https://obsidian.md)
MIT License
689 stars 57 forks source link

Error When Exporting from Obsidian #109

Open DavidHoward21 opened 2 years ago

DavidHoward21 commented 2 years ago

I have the latest PanDoc plugin installed (version 0.2.5) on Obsidian (version: 0.13.23) for Windows on Windows 11. I also have the latest version of PanDoc Installed and have set the path in setting for the PlugIn. Everytime I try to Export, I get an error. It does not matter what format I export to; always an error but no error code. Using PanDoc directly does convert the file from MarkDown to Word.

I have tried this on two computers. What am I missing?

David

DavidHoward21 commented 2 years ago

As an update - the same install process, works fine to export to Word on MacOS. This is a Windows issue.

eik-dahms commented 2 years ago

I have the same problem on an Ubuntu system with all versions up to date. No matter what format - I get 'pandoc export failed:' with no additional context.


I found some error messages which get spawend when I try to use the pandoc plugin on the console:

events.js:292 Uncaught Error: spawn /usr/bin/pandoc ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269)
    at onErrorNT (internal/child_process.js:465)
    at processTicksAndRejections (internal/process/task_queues.js:80)
events.js:292 Uncaught Error: write EPIPE
    at afterWriteDispatched (internal/stream_base_commons.js:156)
    at writeGeneric (internal/stream_base_commons.js:147)
    at Socket._writeGeneric (net.js:785)
    at Socket._write (net.js:797)
    at writeOrBuffer (internal/streams/writable.js:358)
    at Socket.Writable.write (internal/streams/writable.js:303)
    at start (eval at <anonymous> (app.js:1), <anonymous>:335:30)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:374:13)
    at Generator.next (<anonymous>)
    at fulfilled (eval at <anonymous> (app.js:1), <anonymous>:68:58)

These are the args used by the pandoc plugin to run pandoc

"--from", "html", "--to", "pdf", "-o", "[...parth removed... ]/2022-03-06.pdf", "--metadata-file", "/run/user/1000/snap.obsidian/202226-1478673-1023q4f.s6uzg"]

I can execute this in the terminal. But I noticed that the xelatex is missing. which should be in there - because i have installed it and if I read the code correctly here:

if (output.format === 'pdf' && (yield lib.lookpath('xelatex')))
            args.push('--pdf-engine=xelatex');

args should have this flag.

Might this be a library problem in general and I might need to adapt some path variables?

giammi56 commented 2 years ago

@eik-dahms same problem with 20.04.3 LTS, latest pandoc and obsidian. pandoc itself is working from terminal. How have you stared the plugin console, so I can check the error?

laurastephsmith commented 2 years ago

Me too with Debian Sid:

node:events:368 Uncaught Error: spawn /usr/bin/pandoc ENOENT
    at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
    at __node_internal_errnoException (node:internal/errors:594:12)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
__node_internal_captureLargerStackTrace @ node:internal/errors:464
__node_internal_errnoException @ node:internal/errors:594
ChildProcess._handle.onexit @ node:internal/child_process:282
onErrorNT @ node:internal/child_process:477
processTicksAndRejections @ node:internal/process/task_queues:83

/usr/bin/pandoc ENOENT is odd, because:

laura@lauralaptop:~$ ls -hl /usr/bin/pandoc
-rwxr-xr-x 1 root root 148M Mar 15 22:35 /usr/bin/pandoc
xlklwr commented 2 years ago

Same here, on Windows. PanDoc directly (md to docx) works fine, PanDoc plugin in Obsidian say "Export failed:" but no further indication.

silvia-rguez commented 2 years ago

I have the same problem I use the last Obsidian version and I just installed the PanDoc plugin and the pandoc api. It would be super handy to have this plugin working :).

Thank you.

Pika78 commented 2 years ago

I have the same issue on Mac OS with both late versions of PanDoc plugin and Obsidian. Thank you for your help. Regards

laurastephsmith commented 2 years ago

I've solved my issue now. I have Obsidian installed as a Flatpak on Debian. Windows and Mac people, you have a different problem from me. In Obsidian if you open the console (press shift-ctrl-i or shift-cmd-i), do you get any red errors there?

laurastephsmith commented 2 years ago

I have the same problem on an Ubuntu system with all versions up to date. No matter what format - I get 'pandoc export failed:' with no additional context. [...] events.js:292 Uncaught Error: spawn /usr/bin/pandoc ENOENT

@eik-dahms Do you have Obisidian installed as a snap/flatpak? I'm guessing on Ubuntu you might have the snap. I had to give the flatpak permission to access the pandoc binary at /usr/bin/pandoc. Your ENOENT error means your Obisidan can't find the pandoc binary. Does the file /usr/bin/pandoc exist on your system? If it does, and you've used a snap, we need to find out how to give the snap access to that file.

Pika78 commented 2 years ago

Hello I resolved the issue I had : indeed none of the template I tried ((letter, article, memoir, book. ) worked when I entered them in the "Extra pandoc arguments" window (--template memoir, etc). However the plug-in works very well when I specify the template in the heading of the md file like for instance:


template: memoir mainfont: Old Standard title: title author: author date: date

regards

laurastephsmith commented 2 years ago

Hi @Pika78 - glad you found a workaround. I'll make sure this gets flagged to be looked at at some point. Thanks for the feedback!

Pika78 commented 2 years ago

Thank you!

tadsn3w commented 2 years ago

It does not work in Windows 10. I have pandoc and latex before I installed the plugin. Installed the plugin and set the path for pandoc and latex. I added the executables at the end of the path. I got messages saying the binary file does not exist. I removed the exe files at the end of the patch in the settings and got a new message "Pandoc Export failed"

I think my solution is to forget about this plugin. It is not ready for prime time.
I created a new markdown file with file name as "Hello" without quotes. The content is Hello. Simple file and all combinations of pandoc failed with pandoc export failed.

I tried and run successfully pandoc manually using the terminal. My files were converted to pdf and docx outside the plugin.

im-richard commented 2 years ago

Came here with the same issue.

Running Windows 11 + latest Obsidian + Plugin.

When attempting to export as PDF; it simply says "Export Failed". However, if I go to Powershell / Command Prompt; pdflatex works.

All the env variables are setup properly.

syloktools commented 2 years ago

Same issue here. Are logs for the error stored anywhere?

bsridatta commented 1 year ago

Help is really appreciated

benny1979 commented 1 year ago

Same issue here.

seipherdj commented 1 year ago

Same issue. Flatpack on Fedora 37

FetchFast commented 1 year ago

I suggest to use the Obsidian Enhancing Export plugin instead by YISH. This bug has been open for a while and it looks like it's never going to be fixed.

mkachlicka commented 1 year ago

Same issue on the newest version of Obsidian and Pandoc on MacOS; the workaround with extra Pandoc arguments doesn't work for me but Obsidian Enhancing Export is doing the job without any issues so far - thanks for suggestion @FetchFast

HernandoR commented 5 months ago

I'm afraid its still exist at the time, Please inform me if any work around