From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/23622 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Signalling error from Python filter Date: Fri, 18 Oct 2019 19:36:11 +0200 Message-ID: References: <3241f1a9-fee2-4203-a070-612fed71c963@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000c7018e059532c5ab" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="51999"; mail-complaints-to="usenet@blaine.gmane.org" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBF7QU7WQKGQERLO2SQY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Oct 18 19:36:26 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-vk1-f186.google.com ([209.85.221.186]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1iLWAr-000DOM-To for gtp-pandoc-discuss@m.gmane.org; Fri, 18 Oct 2019 19:36:26 +0200 Original-Received: by mail-vk1-f186.google.com with SMTP id n79sf2650312vkf.22 for ; Fri, 18 Oct 2019 10:36:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1571420184; cv=pass; d=google.com; s=arc-20160816; b=rNPbtgmZ7WWD9iD+wmXFSKaejDJBhOvlYWx3vLEo+/QLK5/F21TqwkFf2eozvsrNc9 UwfY06v2B+fNikmXLJFefhH96PQX3WYzCjn6340XGHbOQcUU5gnG0dI7lEHqWMyeqMoj z/DXHz19SLSubP5lx8KuajRwZ5FmxnuRQHe7uy/w89fnNMChdJjTWlPSmg7Sl8qh4tnC xxRRRasU75jfd8lonKzhTL91e7cuGH6PNJNmjAw1MrsEP2cz/k1652GwarXvTdmoFwzC iPBaUwk2fTnpXyTtoD2TSBV2zttqWoNT9B5MFT9hMUJMSk2ARB3SeyCfADvQwBi+Sg0/ 5U+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date :from:in-reply-to:references:mime-version:sender:dkim-signature :dkim-signature; bh=89hN/+fn+9CkazDIZ5At0E8C8cWXhrSLcOEdxe4/6d0=; b=B3RqfJU1hejRWIUUL5ZmlwrLmll30KC9vvPGvK0XqEVpkJiYVZOucjiuqdTQkqs774 JVUtssQoTenmoaTiV4liqZF3jMTvrMW69SsQy0AjBjhn5KIk8jyCgXYIoIe5FSfuD5B2 NIuuVMAmqHrseZVc9sXDMMArVDct4SvpVJdAgaOJ9oEbFZ+jSvyv++f3wF/qafglYmrx Z8+F9pmptZkizBUWuqQ395R7KwNdYOo8OlrVrmEkLZq7WpnVLDFaKX5M7J330HV605Zn 8x08Q2vIZTghPHNZou9GF82BB3SpYgANI1ChIZeOJA/eluxHlJldoIJPS5naonHjRsWT w6Rg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QDdwZoK2; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::22a as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:references:in-reply-to:from:date:message-id :subject:to:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=89hN/+fn+9CkazDIZ5At0E8C8cWXhrSLcOEdxe4/6d0=; b=Aull29K4uAGGNJIpIp9kG1SlO5Z6tgbKQ1DmTQ0Dp8D/PtBE/JyCQnn2DXQKEeP77v xbcyGt11N1Q48VjzbCmffkeQFo+IqUvJXKE01hVPuJRoGOWZ8R2VuVzoB+FxcaKnpRAS XXHmnM4KVtkasOl2L8C2+JJ1ctRvG8i/QRfX7c+K6f9c8LEzYWrePc+KEs19XnXSr7Au a6WlIszh7G1dwEG8TwCQIx/ol3GHH04IOkK4gt6qWrsbClhSd8NocHMMN8gqyGTNafdc R8D1DMiwx+xmIA3ibM2afyhy+KdXHditBSkGFAEUXfl4+0kzePlhN2SVjOOFn9b9cjG7 6Dgg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=89hN/+fn+9CkazDIZ5At0E8C8cWXhrSLcOEdxe4/6d0=; b=BnlEHQQkfQL/H8CO1lfPh5jxZaYyZpP8rvOQ/2QmHa9JrVjYBbyeMsjm2eeyNhXK5S j/UjzTFC3B6mmapDPjwbuFYQiejgUtFckHIAyDNJ1dh9eRoJj6k2v8wCBtpP1KIZzJ5z zjJDOTeJ5N1AvCYYS8uIVO/QbtYoEj1r92AlKa5++9gLPRLjPX92sxTQRJID5YXIZ3H8 kZ525oM7sNwqFCSqO5u6Wlj1GMLYBjFUduDsGtkm2AaSIedMPIgfpQDHqlye4KlOItUT 3M5STxIQ1F08yh8v0H1E4wFoSdK7/mR/nRS8KwUpaEXz27MDqLysR8j65X0PYCuB7XXB mbsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:references:in-reply-to:from :date:message-id:subject:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=89hN/+fn+9CkazDIZ5At0E8C8cWXhrSLcOEdxe4/6d0=; b=CLoff0SRnPOBK9rO7VTh570NxHYmBbcgEfwPYtQ27V3qdzxYBcN4U3BHobWXhnfQpq Ia6ynyNli++olfsrNYF78ZSIjL25DZz8Nkm4gz9vWGsGD7sxcQk9F/77yzEZSCvOUhzr NT/dCwSnOJzEal/0YpqYen7+LTumKNa++Aq3GH2YqzX+n2JS65RTwhuDZalfXIZd0OQR pP1s6qAO4mGHk0QtMvB3eMFT4wJATYbK5gDnExHAxVVwPt5kxUNwcmSBdEI3P6aFV0pR TbqUeZtBwsZf9/iOFmsR2pIgSwUt56XC8U8LSS1Tvv+v2yp6SS4pn0W0qup850L2bG/L 0zMw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAWn8Y+M21IIEHOYo8jTLLQT1kQQo6bmo6C5AnCowbrI2/AaD9aZ 8ExZwBPWuvok2CR5oCL5bqo= X-Google-Smtp-Source: APXvYqzJij/Dzmb8NvyoxPfO03S/0Y9rfrXGDlUHtL8PBLYsyuHhLhifaBiBMMejrCOZ5J15JK80Og== X-Received: by 2002:a67:6242:: with SMTP id w63mr164263vsb.233.1571420184402; Fri, 18 Oct 2019 10:36:24 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a67:7c54:: with SMTP id x81ls676038vsc.1.gmail; Fri, 18 Oct 2019 10:36:23 -0700 (PDT) X-Received: by 2002:a67:f10f:: with SMTP id n15mr6374089vsk.40.1571420183348; Fri, 18 Oct 2019 10:36:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571420183; cv=none; d=google.com; s=arc-20160816; b=AAApzUlB9LQoCv5rDdORpP5yS1I50AFDfMj6iFGkxvG4DHttZxz0p/YUFre3S4p/Do 6E/0Sg82zgScdBeVR8RlDFTqejRk9Er10dP/HvnbB0aKLaHO/QP0iqBsXdWy2XTyh2Mo KPYO1ZXLi8MXruLmcBvdPBJeAFl7RxIZP7MF/zUoArjHLhZWOcR2YZwc1BdCClygc8Um jZyBkCCcvs+JW2AQPkiC8iIAWcfKW3pavgJl+MmSwrTXS5uLM2sZ/nHje0Ui6NrHKunU FHPyUwgIiaaXv/tdfT963RtVtd796LBgty8L+Z2+TgWMkmGBIZjl0MrntlnKCSGpWT+p lHJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=wTrlVj7wlxD3BKOerH4AQ8xi5nMtCJFsymKu7wXAyb8=; b=nLYx/oo4FVpRPaE8jik3rXFdKJMAqqVAttymp3sM66ZZPeERaVfuZ2h70jvA1tJBX7 mHPQUdmqYn9d5DWzWIucxwVTpHIzS1XlIiMHDiXUox0WkizNeK9g7aiVdO08N+jtBs2I XxH3RUulD/kxiHLzzvJbiTYYOZWnVB08qjjBYlK7/2V3GkMsLS/8YkhTNWmoV7heUlx9 g7v1QO6swb/+sMhkI7NNvCIVQnsHqCckogYDcRlCwsewgk4ApfiM2plbVO3rrQQtBvL0 Pf0HHiM046b2DIhgqLRhEUz1mX9d+5WJBYUTb3Y7ioFHRMvEyq5AOtJcaOt8O9bGvLhZ P9Vg== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QDdwZoK2; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::22a as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com. [2607:f8b0:4864:20::22a]) by gmr-mx.google.com with ESMTPS id y14si234790uaa.0.2019.10.18.10.36.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Oct 2019 10:36:23 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::22a as permitted sender) client-ip=2607:f8b0:4864:20::22a; Original-Received: by mail-oi1-x22a.google.com with SMTP id a15so5921998oic.0 for ; Fri, 18 Oct 2019 10:36:23 -0700 (PDT) X-Received: by 2002:aca:1719:: with SMTP id j25mr8584151oii.132.1571420182608; Fri, 18 Oct 2019 10:36:22 -0700 (PDT) In-Reply-To: <3241f1a9-fee2-4203-a070-612fed71c963-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QDdwZoK2; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::22a as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:23622 Archived-At: --000000000000c7018e059532c5ab Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Have you tried to just throw an exception or print a message to stderr? As far as I know pandoc will forward it to its own stderr in an orderly manner, unless the python filter library you are using does something funny= . Den fre 18 okt. 2019 13:15Bj=C3=B6rn Stenborg sk= rev: > Hi! I'm trying to figure out how best to signal errors from a Python > Pandoc filter. If I detect that something goes wrong during filter > execution, the goal is to print a descriptive error message to the consol= e > and then return an error indication. Unfortunately I can't figure out how > to pass that through Pandoc. > > I could either let my filter print the error to the console and then > signal back to Pandoc that document generation should be aborted, or if > possible return an error message to Pandoc and have Pandoc propagate it u= p > to the script calling the pandoc binary. But throwing an exception > containing the error message leaves me with a not very user-friendly call > trace in the console that obscures the real error message. I can't find a= ny > real documentation of error codes produced by Pandoc and my Haskell skill= s > are atrocious so I'm having a hard time reading the code I'm afraid. > > I have an ugly workaround in embedding the error message within a custom > "tag" in the generated document and then having the document generation > script outside pandoc look for that tag in the generated document and > present the error message that it contains and report the document > generation as failed to the build system. But this is awkward. > > Ideas? > > -- > You received this message because you are subscribed to the Google Groups > "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/3241f1a9-fee2-4203-a070-= 612fed71c963%40googlegroups.com > > . > --=20 You received this message because you are subscribed to the Google Groups "= pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/CADAJKhDQz69H7Htx5muDPPB77C6uC%3DfQnhkmTz2fqXhVE_7Y5Q%40mail= .gmail.com. --000000000000c7018e059532c5ab Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Have you tried to just throw an exception or print a mess= age to stderr? As far as I know pandoc will forward it to its own stderr in= an orderly manner, unless the python filter library you are using does som= ething funny.


Den fre 18 okt. 2019 13:15Bj=C3=B6= rn Stenborg <bjorn.stenborg@= gmail.com> skrev:
Hi! I'm trying to figure out how best to signal errors fr= om a Python Pandoc filter. If I detect that something goes wrong during fil= ter execution, the goal is to print a descriptive error message to the cons= ole and then return an error indication. Unfortunately I can't figure o= ut how to pass that through Pandoc.

I could either= let my filter print the error to the console and then signal back to Pando= c that document generation should be aborted, or if possible return an erro= r message to Pandoc and have Pandoc propagate it up to the script calling t= he pandoc binary. But throwing an exception containing the error message le= aves me with a not very user-friendly call trace in the console that obscur= es the real error message. I can't find any real documentation of error= codes produced by Pandoc and my Haskell skills are atrocious so I'm ha= ving a hard time reading the code I'm afraid.

<= div>I have an ugly workaround in embedding the error message within a custo= m "tag" in the generated document and then having the document ge= neration script outside pandoc look for that tag in the generated document = and present the error message that it contains and report the document gene= ration as failed to the build system. But this is awkward.

Ideas?

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.org= m.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/3241f1a9-fee2= -4203-a070-612fed71c963%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://group= s.google.com/d/msgid/pandoc-discuss/CADAJKhDQz69H7Htx5muDPPB77C6uC%3DfQnhkm= Tz2fqXhVE_7Y5Q%40mail.gmail.com.
--000000000000c7018e059532c5ab--