Py_CompileString and line numbers?

Erwin S. Andreasen erwin at andreasen.com
Mon Sep 16 15:58:41 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?

The alternative to Martin's solution is a hack -- simply prepend the
right amount of newlines before your code so the line numbers will
match up.

-- 
===============================================================
<erwin at andreasen.org>                           Herlev, Denmark     
<URL:http://www.andreasen.org/>                             <*>   
===============================================================




More information about the Python-list mailing list