ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: nil error in guess
Date: Mon, 15 Oct 2012 20:32:45 +0200	[thread overview]
Message-ID: <507C56CD.3040208@wxs.nl> (raw)
In-Reply-To: <46EA4FEC6CF7A54280C3072744109EB2107F24@MBX02.uva.nl>

On 13-10-2012 11:29, Meer, H. van der wrote:
> ! LuaTeX error ...t-04/tex/texmf-context/tex/context/base/grph-inc.lua:221: bad argument #1 to 'match' (string expected, got nil)
> stack traceback:
> 	[C]: in function 'match'
> 	...t-04/tex/texmf-context/tex/context/base/grph-inc.lua:221: in function 'guess'
> 	...t-04/tex/texmf-context/tex/context/base/grph-inc.lua:1145: in function <...t-04/tex/texmf-context/tex/context/base/grph-inc.lua:1143>
> 	(tail call): ?
> 	...t-04/tex/texmf-context/tex/context/base/grph-inc.lua:767: in function 'locate'
> 	...t-04/tex/texmf-context/tex/context/base/grph-inc.lua:844: in function 'identifier'
> 	...t-04/tex/texmf-context/tex/context/base/grph-inc.lua:862: in function 'identify'
> 	<main ctx instance>:1: in main chunk.
>
> The version used is:
> ConTeXt  ver: 2012.10.06 15:31 MKIV  fmt: 2012.10.13  int: english/english
>
>
> Is there a quick fix, or I get stuck at a bad moment.
> Thanks in advance.

function figures.guess(filename)
     local f = io.open(filename,'rb')
     if f then
         local str = f:read(100)
         f:close()
         if str then
             for i=1,#magics do
                 local pattern = magics[i]
                 if pattern.pattern:match(str) then
                     local format = pattern.format
                     if trace_figures then
                         report_inclusion("file %q has format 
%s",filename,format)
                     end
                     return format
                 end
             end
         end
     end
end

One might wonder why str is nil.

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


      reply	other threads:[~2012-10-15 18:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-13  9:29 Meer, H. van der
2012-10-15 18:32 ` Hans Hagen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=507C56CD.3040208@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).