Py_CompileString and line numbers?

Martin v. Loewis martin at v.loewis.de
Mon Sep 16 12:42:08 EDT 2002


Sebastian Andersson <sa at hogia.net> writes:

> I'm parsing a config file and from there I get embedded python code
> which I send to Py_CompileString, with the config file's filename given
> as filename argument to Py_CompileString. Later, when errors are found
> in the python code, the wrong line numbers are reported. Is there
> a way to tell Py_CompileString an offset for the first line that
> I give to it?

No. You'll have to instantiate a tokenizer yourself, and set its
lineno member.

HTH,
Martin




More information about the Python-list mailing list