Re: internal error

Bram Moolenaar <[email protected]> Sat, 17 Dec 2005 16:24:03 +0100
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Calmar wrote:

> with this recipe (stripped down, so it makes no sense actually, but it
> still produces the error) I can produce an internal error:
>=20
> ,------------------------------------------------------
> | index_title =3D  whateverhere
> |
> | :rule %.php : %.part
> |         tmpstring =3D _no.$(match)_title
> |         @title =3D eval( tmpstring )
> |
> | files =3D
> |     ./ddd/test.php
> |     ./index.php
> |
> | all : $files
> `---
>=20
> It seems aap lets python evaluate a variable that does not
> exist:   _no.test_title

Well, this happens in the eval() call, which is a Python function.  Thus
you get a Python error message.

We could make an exception for errors in Scope.py, since this is
probably a variable that doesn't exist.  Try this patch:

Index: Process.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/a-a-p/Exec/Process.py,v
retrieving revision 1.71
diff -u -r1.71 Process.py
--- Process.py	29 Nov 2005 10:19:46 -0000	1.71
+++ Process.py	17 Dec 2005 15:06:38 -0000
@@ -556,8 +556,11 @@
         while tb.tb_next:
             tb =3D tb.tb_next
         fname =3D tb.tb_frame.f_code.co_filename
-        if py_line_nr =3D=3D -2 or (fname and not fname =3D=3D "<string>=
"):
+        if py_line_nr =3D=3D -2 or (fname and not fname =3D=3D "<string>=
"
+                                       and string.find(fname, "Scope.py"=
) < 0):
             # If there is a filename, it's not an error in the script.
+            # Except when the filename is Scope.py, then it's probably a
+            # variable that could not be found.
             from Main import error_msg
             error_msg(recdict, _("Internal Error"))
             # traceback.print_exc()

--=20
ROBIN:  (warily) And if you get a question wrong?
ARTHUR: You are cast into the Gorge of Eternal Peril.
ROBIN:  Oh ... wacho!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURE=
S LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \=
\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ =
\\\
\\\        download, build and distribute -- http://www.A-A-P.org        =
///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         /=
//


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi=
les
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick